diff options
author | Yexo <Yexo@openttd.org> | 2009-02-08 11:34:51 +0000 |
---|---|---|
committer | Yexo <Yexo@openttd.org> | 2009-02-08 11:34:51 +0000 |
commit | 1fbb8d3ac3f0f7a510de68c1f8b10d786013b9ba (patch) | |
tree | b0e0422db53a7f512277d2094166dbf26834153b | |
parent | bf42e60bbab55108bbeb2d923209f28badef9a35 (diff) | |
download | openttd-1fbb8d3ac3f0f7a510de68c1f8b10d786013b9ba.tar.xz |
(svn r15408) -Fix (r15027): AIs could call AIController::Sleep() at times they're not allowed to sleep.
-rw-r--r-- | src/ai/api/ai_controller.cpp | 5 |
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; |