changeset 11067:c37ce2c6bf2e draft

(svn r15408) -Fix (r15027): AIs could call AIController::Sleep() at times they're not allowed to sleep.
author Yexo <Yexo@openttd.org>
date Sun, 08 Feb 2009 11:34:51 +0000
parents dc14bcf4630a
children 396066d79e9d
files src/ai/api/ai_controller.cpp
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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;