From 98103121d4f2ed1f1581919b7b1f343ccd410c12 Mon Sep 17 00:00:00 2001 From: truebrain Date: Tue, 29 Nov 2011 23:15:35 +0000 Subject: (svn r23355) -Codechange: rename all AI* to Script* (Rubidium) --- src/script/api/script_controller.cpp | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) (limited to 'src/script/api/script_controller.cpp') diff --git a/src/script/api/script_controller.cpp b/src/script/api/script_controller.cpp index bdd9bc1a7..163335f3d 100644 --- a/src/script/api/script_controller.cpp +++ b/src/script/api/script_controller.cpp @@ -22,38 +22,38 @@ #include "../../ai/ai.hpp" #include "script_log.hpp" -/* static */ void AIController::SetCommandDelay(int ticks) +/* static */ void ScriptController::SetCommandDelay(int ticks) { if (ticks <= 0) return; - AIObject::SetDoCommandDelay(ticks); + ScriptObject::SetDoCommandDelay(ticks); } -/* static */ void AIController::Sleep(int ticks) +/* static */ void ScriptController::Sleep(int ticks) { - if (!AIObject::CanSuspend()) { + if (!ScriptObject::CanSuspend()) { throw AI_FatalError("You are not allowed to call Sleep in your constructor, Save(), Load(), and any valuator."); } if (ticks <= 0) { - AILog::Warning("Sleep() value should be > 0. Assuming value 1."); + ScriptLog::Warning("Sleep() value should be > 0. Assuming value 1."); ticks = 1; } throw AI_VMSuspend(ticks, NULL); } -/* static */ void AIController::Print(bool error_msg, const char *message) +/* static */ void ScriptController::Print(bool error_msg, const char *message) { - AILog::Log(error_msg ? AILog::LOG_SQ_ERROR : AILog::LOG_SQ_INFO, message); + ScriptLog::Log(error_msg ? ScriptLog::LOG_SQ_ERROR : ScriptLog::LOG_SQ_INFO, message); } -AIController::AIController() : +ScriptController::ScriptController() : ticks(0), loaded_library_count(0) { } -AIController::~AIController() +ScriptController::~ScriptController() { for (LoadedLibraryList::iterator iter = this->loaded_library.begin(); iter != this->loaded_library.end(); iter++) { free((*iter).second); @@ -63,30 +63,30 @@ AIController::~AIController() this->loaded_library.clear(); } -/* static */ uint AIController::GetTick() +/* static */ uint ScriptController::GetTick() { - return AIObject::GetActiveInstance()->GetController()->ticks; + return ScriptObject::GetActiveInstance()->GetController()->ticks; } -/* static */ int AIController::GetOpsTillSuspend() +/* static */ int ScriptController::GetOpsTillSuspend() { - return AIObject::GetActiveInstance()->GetOpsTillSuspend(); + return ScriptObject::GetActiveInstance()->GetOpsTillSuspend(); } -/* static */ int AIController::GetSetting(const char *name) +/* static */ int ScriptController::GetSetting(const char *name) { return AIConfig::GetConfig(_current_company)->GetSetting(name); } -/* static */ uint AIController::GetVersion() +/* static */ uint ScriptController::GetVersion() { return _openttd_newgrf_version; } -/* static */ HSQOBJECT AIController::Import(const char *library, const char *class_name, int version) +/* static */ HSQOBJECT ScriptController::Import(const char *library, const char *class_name, int version) { - AIController *controller = AIObject::GetActiveInstance()->GetController(); - Squirrel *engine = AIObject::GetActiveInstance()->engine; + ScriptController *controller = ScriptObject::GetActiveInstance()->GetController(); + Squirrel *engine = ScriptObject::GetActiveInstance()->engine; HSQUIRRELVM vm = engine->GetVM(); /* Internally we store libraries as 'library.version' */ -- cgit v1.2.3-54-g00ecf