diff options
author | truebrain <truebrain@openttd.org> | 2011-11-29 23:27:01 +0000 |
---|---|---|
committer | truebrain <truebrain@openttd.org> | 2011-11-29 23:27:01 +0000 |
commit | 880f377fa61d8c87dc409f25447515509348bb45 (patch) | |
tree | 25d8e5f4bb15d3867b87452d578a605ff957ba06 /src/ai | |
parent | 3e6d0261291a1c91bf4f57c06fd9d180c175befc (diff) | |
download | openttd-880f377fa61d8c87dc409f25447515509348bb45.tar.xz |
(svn r23367) -Codechange: refactor GetSetting to ScriptInstance, to avoid global variable in script_controller
Diffstat (limited to 'src/ai')
-rw-r--r-- | src/ai/ai_instance.cpp | 5 | ||||
-rw-r--r-- | src/ai/ai_instance.hpp | 2 |
2 files changed, 7 insertions, 0 deletions
diff --git a/src/ai/ai_instance.cpp b/src/ai/ai_instance.cpp index 2df8c2e44..a360d516c 100644 --- a/src/ai/ai_instance.cpp +++ b/src/ai/ai_instance.cpp @@ -235,6 +235,11 @@ void AIInstance::LoadDummyScript() Script_CreateDummy(this->engine->GetVM(), STR_ERROR_AI_NO_AI_FOUND, "AI"); } +int AIInstance::GetSetting(const char *name) +{ + return AIConfig::GetConfig(_current_company)->GetSetting(name); +} + /** * DoCommand callback function for all commands executed by AIs. * @param result The result of the command. diff --git a/src/ai/ai_instance.hpp b/src/ai/ai_instance.hpp index 886b716ae..01c472b03 100644 --- a/src/ai/ai_instance.hpp +++ b/src/ai/ai_instance.hpp @@ -26,6 +26,8 @@ public: */ void Initialize(class AIInfo *info); + /* virtual */ int GetSetting(const char *name); + private: const char *versionAPI; ///< Current API used by this script. |