From 6d8f0f5156c54c7ac81aef704921c18524868fd3 Mon Sep 17 00:00:00 2001 From: elexis Date: Tue, 8 May 2018 09:24:16 +0000 Subject: [PATCH] In preparation of renaming and grouping main.cpp shutdown variables: Declare the g_GameRestarted hack from rP4520 in main.cpp, because it is main.cpp and Game.cpp who provide it's value. Move the comment so that the connotation becomes clear when reading main.cpp. Remove the extern declaration introduced to the Renderer in rP12802 that became obsolete with rP12817. git-svn-id: https://svn.wildfiregames.com/public/ps/trunk@21816 3db68df2-c116-0410-a063-a993310a9797 --- source/gui/MiniMap.cpp | 2 +- source/main.cpp | 4 +++- source/ps/Game.cpp | 1 - source/ps/tests/stub_impl_hack.h | 5 ++++- source/renderer/Renderer.cpp | 2 -- 5 files changed, 8 insertions(+), 6 deletions(-) diff --git a/source/gui/MiniMap.cpp b/source/gui/MiniMap.cpp index ab39655a30..0ab0d757a3 100644 --- a/source/gui/MiniMap.cpp +++ b/source/gui/MiniMap.cpp @@ -48,7 +48,7 @@ #include "simulation2/components/ICmpMinimap.h" #include "simulation2/system/ParamNode.h" -bool g_GameRestarted = false; +extern bool g_GameRestarted; // Set max drawn entities to UINT16_MAX for now, which is more than enough // TODO: we should be cleverer about drawing them to reduce clutter diff --git a/source/main.cpp b/source/main.cpp index ee6a3bbfe4..b7f2e6db53 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -89,11 +89,13 @@ that of Atlas depending on commandline parameters. #define getpid _getpid // Use the non-deprecated function name #endif -extern bool g_GameRestarted; extern CStrW g_UniqueLogPostfix; void kill_mainloop(); +// Marks terrain as modified so the minimap can repaint (is there a cleaner way of handling this?) +bool g_GameRestarted = false; + // to avoid redundant and/or recursive resizing, we save the new // size after VIDEORESIZE messages and only update the video mode // once per frame. diff --git a/source/ps/Game.cpp b/source/ps/Game.cpp index 26b5842d1b..6ed28df9a7 100644 --- a/source/ps/Game.cpp +++ b/source/ps/Game.cpp @@ -333,7 +333,6 @@ PSRETURN CGame::ReallyStartGame() if (CProfileManager::IsInitialised()) g_Profiler.StructuralReset(); - // Mark terrain as modified so the minimap can repaint (is there a cleaner way of handling this?) g_GameRestarted = true; return 0; diff --git a/source/ps/tests/stub_impl_hack.h b/source/ps/tests/stub_impl_hack.h index ec0618a128..fc34795a74 100644 --- a/source/ps/tests/stub_impl_hack.h +++ b/source/ps/tests/stub_impl_hack.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2014 Wildfire Games. +/* Copyright (C) 2018 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -19,6 +19,9 @@ // usually defined by main.cpp, used by engine's scripting/ScriptFunctions.cpp, // must be included here to placate linker. + +bool g_GameRestarted; + void kill_mainloop() { } diff --git a/source/renderer/Renderer.cpp b/source/renderer/Renderer.cpp index ec4a775519..eb36876c67 100644 --- a/source/renderer/Renderer.cpp +++ b/source/renderer/Renderer.cpp @@ -75,8 +75,6 @@ #include "renderer/WaterManager.h" #include "scriptinterface/ScriptInterface.h" -extern bool g_GameRestarted; - struct SScreenRect { GLint x1, y1, x2, y2; -- 2.11.4.GIT