summaryrefslogtreecommitdiff
path: root/src/game
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2012-01-02 22:44:28 +0000
committerrubidium <rubidium@openttd.org>2012-01-02 22:44:28 +0000
commitd2f776ef3ee7bd78eb1daec310f3e253b8323ea0 (patch)
treea2bd78f0098c6b405fa3a0bd0e700546a06a47e3 /src/game
parent8371ecc9229c91066d0d933020598b07ad3e4400 (diff)
downloadopenttd-d2f776ef3ee7bd78eb1daec310f3e253b8323ea0.tar.xz
(svn r23720) -Fix/Feature [FS#4935]: show the script debug window also when the game script crashes
Diffstat (limited to 'src/game')
-rw-r--r--src/game/game_instance.cpp19
-rw-r--r--src/game/game_instance.hpp1
2 files changed, 20 insertions, 0 deletions
diff --git a/src/game/game_instance.cpp b/src/game/game_instance.cpp
index 7ab235cc7..9535c6abe 100644
--- a/src/game/game_instance.cpp
+++ b/src/game/game_instance.cpp
@@ -11,11 +11,13 @@
#include "../stdafx.h"
#include "../debug.h"
+#include "../error.h"
#include "../saveload/saveload.h"
#include "../script/squirrel_class.hpp"
#include "../script/script_storage.hpp"
+#include "../ai/ai_gui.hpp"
#include "game_config.hpp"
#include "game_info.hpp"
#include "game_instance.hpp"
@@ -196,6 +198,23 @@ ScriptInfo *GameInstance::FindLibrary(const char *library, int version)
return (ScriptInfo *)Game::FindLibrary(library, version);
}
+void GameInstance::Died()
+{
+ ScriptInstance::Died();
+
+ ShowAIDebugWindow(OWNER_DEITY);
+
+ const GameInfo *info = Game::GetInfo();
+ if (info != NULL) {
+ ShowErrorMessage(STR_ERROR_AI_PLEASE_REPORT_CRASH, INVALID_STRING_ID, WL_WARNING);
+
+ if (info->GetURL() != NULL) {
+ ScriptLog::Info("Please report the error to the following URL:");
+ ScriptLog::Info(info->GetURL());
+ }
+ }
+}
+
/**
* DoCommand callback function for all commands executed by Game Scripts.
* @param result The result of the command.
diff --git a/src/game/game_instance.hpp b/src/game/game_instance.hpp
index efb67398d..08ce34424 100644
--- a/src/game/game_instance.hpp
+++ b/src/game/game_instance.hpp
@@ -30,6 +30,7 @@ public:
private:
/* virtual */ void RegisterAPI();
+ /* virtual */ void Died();
/* virtual */ CommandCallback *GetDoCommandCallback();
/* virtual */ void LoadDummyScript() {}
};