From 4072dcff49930b1eb6e2a8489cbce1970f39caec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Guilloux?= Date: Fri, 17 Feb 2023 12:24:51 +0100 Subject: [PATCH] Fix #10486: [Script] Debug window requires AIs to be started before GS (#10487) --- src/saveload/afterload.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/saveload/afterload.cpp b/src/saveload/afterload.cpp index b22797032e..854bb5b56f 100644 --- a/src/saveload/afterload.cpp +++ b/src/saveload/afterload.cpp @@ -544,14 +544,16 @@ static inline bool MayHaveBridgeAbove(TileIndex t) */ static void StartScripts() { - /* Start the GameScript. */ - Game::StartNew(); + /* Script debug window requires AIs to be started before trying to start GameScript. */ /* Start the AIs. */ for (const Company *c : Company::Iterate()) { if (Company::IsValidAiID(c->index)) AI::StartNew(c->index, false); } + /* Start the GameScript. */ + Game::StartNew(); + ShowScriptDebugWindowIfScriptError(); }