(svn r23720) -Fix/Feature [FS#4935]: show the script debug window also when the game script crashes

This commit is contained in:
rubidium
2012-01-02 22:44:28 +00:00
parent 8371ecc922
commit d2f776ef3e
4 changed files with 26 additions and 1 deletions

View File

@@ -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.