summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2010-03-11 21:55:37 +0000
committerrubidium <rubidium@openttd.org>2010-03-11 21:55:37 +0000
commite3fb793a8a6d4bab58e68c54736a655e2373b78c (patch)
tree25bb7789784e85249b4500c1a4fd2be62c197116
parent8b041e8027d4c8bee35731e62e39129b85dd6122 (diff)
downloadopenttd-e3fb793a8a6d4bab58e68c54736a655e2373b78c.tar.xz
(svn r19388) -Fix [FS#3666]: [NoAI] When reloading a savegame, an AI failing to compile could trigger (trying) to read the not yet loaded information of another AI via the AI Debug window and its "open with the most recently used AI" feature
-rw-r--r--src/ai/ai_gui.cpp8
-rw-r--r--src/misc.cpp2
2 files changed, 10 insertions, 0 deletions
diff --git a/src/ai/ai_gui.cpp b/src/ai/ai_gui.cpp
index beeed22bc..c7ff796d9 100644
--- a/src/ai/ai_gui.cpp
+++ b/src/ai/ai_gui.cpp
@@ -1016,3 +1016,11 @@ void ShowAIDebugWindow(CompanyID show_company)
ShowErrorMessage(STR_ERROR_AI_DEBUG_SERVER_ONLY, INVALID_STRING_ID, WL_INFO);
}
}
+
+/**
+ * Reset the AI windows to their initial state.
+ */
+void InitializeAIGui()
+{
+ AIDebugWindow::ai_debug_company = INVALID_COMPANY;
+}
diff --git a/src/misc.cpp b/src/misc.cpp
index 995f0dd5e..7ec606b5a 100644
--- a/src/misc.cpp
+++ b/src/misc.cpp
@@ -41,6 +41,7 @@ void InitializeRailGui();
void InitializeRoadGui();
void InitializeAirportGui();
void InitializeDockGui();
+void InitializeAIGui();
void InitializeIndustries();
void InitializeTowns();
void InitializeSubsidies();
@@ -92,6 +93,7 @@ void InitializeGame(uint size_x, uint size_y, bool reset_date, bool reset_settin
InitializeRoadGui();
InitializeAirportGui();
InitializeDockGui();
+ InitializeAIGui();
InitializeTowns();
InitializeSubsidies();
InitializeTrees();