From 6b619cfb38a5127d46ce83d8f43a82cf7881bf57 Mon Sep 17 00:00:00 2001 From: janwas Date: Sat, 8 Aug 2009 10:04:43 +0000 Subject: [PATCH] remove obsolete NO_GUI that's just cluttering up the code This was SVN commit r7086. --- source/main.cpp | 4 ---- source/ps/Game.cpp | 7 ------- source/ps/GameSetup/GameSetup.cpp | 30 +++++------------------------- source/scripting/ScriptGlue.cpp | 6 +----- 4 files changed, 6 insertions(+), 41 deletions(-) diff --git a/source/main.cpp b/source/main.cpp index dde1748840..5865a2920c 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -259,9 +259,7 @@ static void Frame() PROFILE_START("gui tick"); MICROLOG(L"gui tick"); -#ifndef NO_GUI g_GUI.TickObjects(); -#endif PROFILE_END("gui tick"); ogl_WarnIfError(); @@ -347,9 +345,7 @@ static void MainControllerInit() // gui_handler needs to be registered after (i.e. called before!) the // hotkey handler so that input boxes can be typed in without // setting off hotkeys. -#ifndef NO_GUI in_add_handler(gui_handler); -#endif // must be registered after gui_handler. Should mayhap even be last. in_add_handler(MainInputHandler); diff --git a/source/ps/Game.cpp b/source/ps/Game.cpp index ef4afdf387..6f4e886eb4 100644 --- a/source/ps/Game.cpp +++ b/source/ps/Game.cpp @@ -40,9 +40,7 @@ #include "simulation/EntityManager.h" #include "simulation/Simulation.h" -#ifndef NO_GUI #include "gui/CGUI.h" -#endif class CNetServer; extern CNetServer *g_NetServer; @@ -133,8 +131,6 @@ PSRETURN CGame::RegisterInit(CGameAttributes* pAttribs) **/ PSRETURN CGame::ReallyStartGame() { -#ifndef NO_GUI - // Call the reallyStartGame GUI function, but only if it exists jsval fval, rval; JSBool ok = JS_GetProperty(g_ScriptingHost.getContext(), g_GUI.GetScriptObject(), "reallyStartGame", &fval); @@ -144,7 +140,6 @@ PSRETURN CGame::ReallyStartGame() ok = JS_CallFunctionValue(g_ScriptingHost.getContext(), g_GUI.GetScriptObject(), fval, 0, NULL, &rval); debug_assert(ok); } -#endif debug_printf("GAME STARTED, ALL INIT COMPLETE\n"); m_GameStarted=true; @@ -156,9 +151,7 @@ PSRETURN CGame::ReallyStartGame() g_GameRestarted = true; -#ifndef NO_GUI g_GUI.SendEventToAll("sessionstart"); -#endif return 0; } diff --git a/source/ps/GameSetup/GameSetup.cpp b/source/ps/GameSetup/GameSetup.cpp index 85c2a8cb2d..55fce08384 100644 --- a/source/ps/GameSetup/GameSetup.cpp +++ b/source/ps/GameSetup/GameSetup.cpp @@ -80,11 +80,9 @@ #include "ps/scripting/JSInterface_Console.h" #include "ps/scripting/JSCollection.h" #include "simulation/scripting/SimulationScriptInit.h" -#ifndef NO_GUI -# include "gui/scripting/JSInterface_IGUIObject.h" -# include "gui/scripting/JSInterface_GUITypes.h" -# include "gui/GUI.h" -#endif +#include "gui/scripting/JSInterface_IGUIObject.h" +#include "gui/scripting/JSInterface_GUITypes.h" +#include "gui/GUI.h" #include "sound/JSI_Sound.h" #include "network/NetLog.h" @@ -129,9 +127,7 @@ static int SetVideoMode(int w, int h, int bpp, bool fullscreen) glViewport(0, 0, w, h); -#ifndef NO_GUI g_GUI.UpdateResolution(); -#endif ogl_Init(); // required after each mode change @@ -207,7 +203,6 @@ retry: void GUI_Init() { -#ifndef NO_GUI {TIMER("ps_gui_init"); g_GUI.Initialize();} @@ -242,16 +237,13 @@ void GUI_Init() g_GUI.LoadXmlFile("gui/test/7_atlas.xml");} {TIMER("ps_gui_9"); g_GUI.LoadXmlFile("gui/test/9_global.xml");} -#endif } void GUI_Shutdown() { -#ifndef NO_GUI g_GUI.Destroy(); delete &g_GUI; -#endif } @@ -264,13 +256,11 @@ void GUI_ShowMainMenu() // display progress / description in loading screen void GUI_DisplayLoadProgress(int percent, const wchar_t* pending_task) { -#ifndef NO_GUI CStrW i18n_description = I18n::translate(pending_task); JSString* js_desc = StringConvert::wstring_to_jsstring(g_ScriptingHost.getContext(), i18n_description); g_ScriptingHost.SetGlobal("g_Progress", INT_TO_JSVAL(percent)); g_ScriptingHost.SetGlobal("g_LoadDescription", STRING_TO_JSVAL(js_desc)); g_GUI.SendEventToAll("progress"); -#endif } @@ -281,13 +271,11 @@ void Render() ogl_WarnIfError(); -#ifndef NO_GUI // HACK: because colour-parsing requires the GUI CStr skystring = "61 193 255"; CFG_GET_USER_VAL("skycolor", String, skystring); CColor skycol; GUI::ParseString(skystring, skycol); g_Renderer.SetClearColor(skycol.AsSColor4ub()); -#endif // start new frame g_Renderer.BeginFrame(); @@ -397,13 +385,11 @@ void Render() ogl_WarnIfError(); -#ifndef NO_GUI // Temp GUI message GeeTODO MICROLOG(L"render GUI"); PROFILE_START( "render gui" ); if(g_DoRenderGui) g_GUI.Draw(); PROFILE_END( "render gui" ); -#endif ogl_WarnIfError(); @@ -515,10 +501,8 @@ static void RegisterJavascriptInterfaces() SimulationScriptInit(); // GUI -#ifndef NO_GUI JSI_IGUIObject::init(); JSI_GUITypes::init(); -#endif } @@ -1040,9 +1024,7 @@ void Init(const CmdLineArgs& args, int flags) const bool setup_gui = ((flags & INIT_NO_GUI) == 0 && g_AutostartMap.empty()); // GUI is notified in SetVideoMode, so this must come before that. -#ifndef NO_GUI new CGUI; -#endif // default to windowed, so users don't get stuck if e.g. half the // filesystem is missing and the config files aren't loaded @@ -1149,12 +1131,10 @@ void Init(const CmdLineArgs& args, int flags) ogl_WarnIfError(); -#ifndef NO_GUI { - TIMER("Init_guiload"); - g_GUI.SendEventToAll("load"); + TIMER("Init_guiload"); + g_GUI.SendEventToAll("load"); } -#endif if (g_FixedFrameTiming) { CCamera &camera = *g_Game->GetView()->GetCamera(); diff --git a/source/scripting/ScriptGlue.cpp b/source/scripting/ScriptGlue.cpp index 4b89f0fb95..62d8657d5a 100644 --- a/source/scripting/ScriptGlue.cpp +++ b/source/scripting/ScriptGlue.cpp @@ -73,9 +73,7 @@ #include "simulation/TechnologyCollection.h" #include "simulation/TriggerManager.h" -#ifndef NO_GUI -# include "gui/scripting/JSInterface_IGUIObject.h" -#endif +#include "gui/scripting/JSInterface_IGUIObject.h" extern bool g_TerrainModified; @@ -1483,11 +1481,9 @@ JSFunctionSpec ScriptFunctionTable[] = JS_FUNC("toggleTerritoryRendering", ToggleTerritoryRendering, 0) // GUI -#ifndef NO_GUI JS_FUNC("getGUIObjectByName", JSI_IGUIObject::getByName, 1) // external JS_FUNC("getGUIGlobal", GetGuiGlobal, 0) JS_FUNC("resetGUI", ResetGui, 0) -#endif // Events JS_FUNC("addGlobalHandler", AddGlobalHandler, 2)