summaryrefslogtreecommitdiff
path: root/src/ai/api
diff options
context:
space:
mode:
Diffstat (limited to 'src/ai/api')
-rw-r--r--src/ai/api/ai_controller.cpp3
-rw-r--r--src/ai/api/ai_object.cpp3
2 files changed, 2 insertions, 4 deletions
diff --git a/src/ai/api/ai_controller.cpp b/src/ai/api/ai_controller.cpp
index 24510b7e7..7553f5944 100644
--- a/src/ai/api/ai_controller.cpp
+++ b/src/ai/api/ai_controller.cpp
@@ -24,8 +24,7 @@
/* static */ void AIController::Sleep(int ticks)
{
if (!AIObject::GetAllowDoCommand()) {
- AILog::Error("You are not allowed to call Sleep in your constructor, Save(), Load(), and any valuator.\n");
- return;
+ throw AI_FatalError("You are not allowed to call Sleep in your constructor, Save(), Load(), and any valuator.");
}
if (ticks <= 0) {
diff --git a/src/ai/api/ai_object.cpp b/src/ai/api/ai_object.cpp
index bb17e58f8..825c76c30 100644
--- a/src/ai/api/ai_object.cpp
+++ b/src/ai/api/ai_object.cpp
@@ -191,8 +191,7 @@ int AIObject::GetCallbackVariable(int index)
bool AIObject::DoCommand(TileIndex tile, uint32 p1, uint32 p2, uint cmd, const char *text, AISuspendCallbackProc *callback)
{
if (AIObject::GetAllowDoCommand() == false) {
- AILog::Error("You are not allowed to execute any DoCommand (even indirect) in your constructor, Save(), Load(), and any valuator.\n");
- return false;
+ throw AI_FatalError("You are not allowed to execute any DoCommand (even indirect) in your constructor, Save(), Load(), and any valuator.");
}
CommandCost res;