From 12f0720f31be0726a4ce1a9246cdcc25f94945fd Mon Sep 17 00:00:00 2001 From: Matei Date: Sun, 8 Oct 2006 03:28:22 +0000 Subject: [PATCH] More minimap fixes on game restart (recalculate everything because the map size might have changed). This was SVN commit r4520. --- source/gui/MiniMap.cpp | 5 +++-- source/main.cpp | 2 ++ source/ps/Game.cpp | 9 +++++---- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/source/gui/MiniMap.cpp b/source/gui/MiniMap.cpp index 51eb084bd2..0742b92f5d 100644 --- a/source/gui/MiniMap.cpp +++ b/source/gui/MiniMap.cpp @@ -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 diff --git a/source/main.cpp b/source/main.cpp index 74e87c9a89..66ba6cd214 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -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; } diff --git a/source/ps/Game.cpp b/source/ps/Game.cpp index 07e3cea96e..9dcf8f7287 100644 --- a/source/ps/Game.cpp +++ b/source/ps/Game.cpp @@ -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; }