summaryrefslogtreecommitdiff
path: root/src/ai
diff options
context:
space:
mode:
authorYexo <yexo@openttd.org>2009-02-08 11:34:51 +0000
committerYexo <yexo@openttd.org>2009-02-08 11:34:51 +0000
commit5bcdcdd1d17720be013b26ab91218bccc04bdc78 (patch)
treeb0e0422db53a7f512277d2094166dbf26834153b /src/ai
parent5f8c2b1b4eeda10a054317578c36d89ccdeaf926 (diff)
downloadopenttd-5bcdcdd1d17720be013b26ab91218bccc04bdc78.tar.xz
(svn r15408) -Fix (r15027): AIs could call AIController::Sleep() at times they're not allowed to sleep.
Diffstat (limited to 'src/ai')
-rw-r--r--src/ai/api/ai_controller.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/ai/api/ai_controller.cpp b/src/ai/api/ai_controller.cpp
index 96f9715a8..d11a2add5 100644
--- a/src/ai/api/ai_controller.cpp
+++ b/src/ai/api/ai_controller.cpp
@@ -22,6 +22,11 @@
/* 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;
+ }
+
if (ticks <= 0) {
AILog::Warning("Sleep() value should be > 0. Assuming value 1.");
ticks = 1;