1
0
forked from 0ad/0ad

More minimap fixes on game restart (recalculate everything because the map size might have changed).

This was SVN commit r4520.
This commit is contained in:
Matei 2006-10-08 03:28:22 +00:00
parent ba4d30d149
commit 12f0720f31
3 changed files with 10 additions and 6 deletions

View File

@ -28,6 +28,7 @@
bool g_TerrainModified = false;
bool g_GameRestarted = false;
// used by GetMapSpaceCoords (precalculated as an optimization).
// this was formerly access via inline asm, which required it to be
@ -230,7 +231,7 @@ void CMiniMap::Draw()
// happens when the game is started, so abort until then.
if(!(GetGUI() && g_Game && g_Game->IsGameStarted()))
return;
glDisable(GL_DEPTH_TEST);
// Set our globals in case they hadn't been set before
@ -245,7 +246,7 @@ void CMiniMap::Draw()
m_scaleX = float(m_Width) / float(m_MapSize - 1);
m_scaleY = float(m_Height) / float(m_MapSize - 1);
if(!m_TerrainTexture)
if(!m_TerrainTexture || g_GameRestarted)
CreateTextures();
// do not limit this as with LOS updates below - we must update

View File

@ -44,6 +44,7 @@ that of Atlas depending on commandline parameters.
#define LOG_CATEGORY "main"
extern bool g_TerrainModified;
extern bool g_GameRestarted;
void kill_mainloop();
@ -317,6 +318,7 @@ static void Frame()
kill_mainloop();
g_TerrainModified = false;
g_GameRestarted = false;
}

View File

@ -19,7 +19,7 @@
#include "graphics/GameView.h"
extern CConsole* g_Console;
extern bool g_TerrainModified;
extern bool g_GameRestarted;
CGame *g_Game=NULL;
@ -101,13 +101,14 @@ PSRETURN CGame::ReallyStartGame()
// The call tree we've built for pregame probably isn't useful in-game.
g_Profiler.StructuralReset();
// Mark terrain as modified so the minimap can repaint (is there a cleaner way of handling this?)
g_GameRestarted = true;
#ifndef NO_GUI
g_GUI.SendEventToAll("sessionstart");
#endif
// Mark terrain as modified so the minimap can repaint (is there a cleaner way of handling this?)
g_TerrainModified = true;
return 0;
}