From bbd9facb44dc09ded5500918319b770c63c0a981 Mon Sep 17 00:00:00 2001 From: truebrain Date: Tue, 29 Nov 2011 23:21:13 +0000 Subject: (svn r23358) -Codechange: move AI_FatalError to Script_FatalError (and to its own file) --- src/script/api/script_controller.cpp | 3 ++- src/script/api/script_execmode.cpp | 3 ++- src/script/api/script_object.cpp | 3 ++- src/script/api/script_testmode.cpp | 3 ++- 4 files changed, 8 insertions(+), 4 deletions(-) (limited to 'src/script/api') diff --git a/src/script/api/script_controller.cpp b/src/script/api/script_controller.cpp index 163335f3d..bc6d060fd 100644 --- a/src/script/api/script_controller.cpp +++ b/src/script/api/script_controller.cpp @@ -20,6 +20,7 @@ #include "../../ai/ai_instance.hpp" #include "../../ai/ai_config.hpp" #include "../../ai/ai.hpp" +#include "../script_fatalerror.hpp" #include "script_log.hpp" /* static */ void ScriptController::SetCommandDelay(int ticks) @@ -31,7 +32,7 @@ /* static */ void ScriptController::Sleep(int ticks) { if (!ScriptObject::CanSuspend()) { - throw AI_FatalError("You are not allowed to call Sleep in your constructor, Save(), Load(), and any valuator."); + throw Script_FatalError("You are not allowed to call Sleep in your constructor, Save(), Load(), and any valuator."); } if (ticks <= 0) { diff --git a/src/script/api/script_execmode.cpp b/src/script/api/script_execmode.cpp index 23f4c683d..e0481b25b 100644 --- a/src/script/api/script_execmode.cpp +++ b/src/script/api/script_execmode.cpp @@ -14,6 +14,7 @@ #include "../../company_base.h" #include "../../company_func.h" #include "../../ai/ai_instance.hpp" +#include "../script_fatalerror.hpp" bool ScriptExecMode::ModeProc() { @@ -34,7 +35,7 @@ ScriptExecMode::~ScriptExecMode() if (this->GetDoCommandModeInstance() != this) { /* Ignore this error if the AI already died. */ if (!ScriptObject::GetActiveInstance()->IsDead()) { - throw AI_FatalError("ScriptExecMode object was removed while it was not the latest AI*Mode object created."); + throw Script_FatalError("ScriptExecMode object was removed while it was not the latest AI*Mode object created."); } } this->SetDoCommandMode(this->last_mode, this->last_instance); diff --git a/src/script/api/script_object.cpp b/src/script/api/script_object.cpp index 0be85a745..cb01d3ee3 100644 --- a/src/script/api/script_object.cpp +++ b/src/script/api/script_object.cpp @@ -17,6 +17,7 @@ #include "../script_storage.hpp" #include "../../ai/ai_instance.hpp" +#include "../script_fatalerror.hpp" #include "script_error.hpp" /** @@ -226,7 +227,7 @@ ScriptObject::ActiveInstance::~ActiveInstance() /* static */ bool ScriptObject::DoCommand(TileIndex tile, uint32 p1, uint32 p2, uint cmd, const char *text, AISuspendCallbackProc *callback) { if (!ScriptObject::CanSuspend()) { - throw AI_FatalError("You are not allowed to execute any DoCommand (even indirect) in your constructor, Save(), Load(), and any valuator."); + throw Script_FatalError("You are not allowed to execute any DoCommand (even indirect) in your constructor, Save(), Load(), and any valuator."); } /* Set the default callback to return a true/false result of the DoCommand */ diff --git a/src/script/api/script_testmode.cpp b/src/script/api/script_testmode.cpp index 87b4aea57..184a8795c 100644 --- a/src/script/api/script_testmode.cpp +++ b/src/script/api/script_testmode.cpp @@ -14,6 +14,7 @@ #include "../../company_base.h" #include "../../company_func.h" #include "../../ai/ai_instance.hpp" +#include "../script_fatalerror.hpp" bool ScriptTestMode::ModeProc() { @@ -34,7 +35,7 @@ ScriptTestMode::~ScriptTestMode() if (this->GetDoCommandModeInstance() != this) { /* Ignore this error if the AI already died. */ if (!ScriptObject::GetActiveInstance()->IsDead()) { - throw AI_FatalError("AITestmode object was removed while it was not the latest AI*Mode object created."); + throw Script_FatalError("AITestmode object was removed while it was not the latest AI*Mode object created."); } } this->SetDoCommandMode(this->last_mode, this->last_instance); -- cgit v1.2.3-54-g00ecf