summaryrefslogtreecommitdiff
path: root/src/script/api
diff options
context:
space:
mode:
authortruebrain <truebrain@openttd.org>2011-11-29 23:27:01 +0000
committertruebrain <truebrain@openttd.org>2011-11-29 23:27:01 +0000
commit880f377fa61d8c87dc409f25447515509348bb45 (patch)
tree25d8e5f4bb15d3867b87452d578a605ff957ba06 /src/script/api
parent3e6d0261291a1c91bf4f57c06fd9d180c175befc (diff)
downloadopenttd-880f377fa61d8c87dc409f25447515509348bb45.tar.xz
(svn r23367) -Codechange: refactor GetSetting to ScriptInstance, to avoid global variable in script_controller
Diffstat (limited to 'src/script/api')
-rw-r--r--src/script/api/script_controller.cpp5
-rw-r--r--src/script/api/script_object.cpp2
2 files changed, 3 insertions, 4 deletions
diff --git a/src/script/api/script_controller.cpp b/src/script/api/script_controller.cpp
index 0638a6651..7fe174756 100644
--- a/src/script/api/script_controller.cpp
+++ b/src/script/api/script_controller.cpp
@@ -11,14 +11,11 @@
#include "../../stdafx.h"
#include "../../string_func.h"
-#include "../../company_base.h"
-#include "../../company_func.h"
#include "../../script/squirrel.hpp"
#include "../../rev.h"
#include "script_controller.hpp"
#include "../../ai/ai_instance.hpp"
-#include "../../ai/ai_config.hpp"
#include "../../ai/ai.hpp"
#include "../script_fatalerror.hpp"
#include "../script_info.hpp"
@@ -78,7 +75,7 @@ ScriptController::~ScriptController()
/* static */ int ScriptController::GetSetting(const char *name)
{
- return AIConfig::GetConfig(_current_company)->GetSetting(name);
+ return ScriptObject::GetActiveInstance()->GetSetting(name);
}
/* static */ uint ScriptController::GetVersion()
diff --git a/src/script/api/script_object.cpp b/src/script/api/script_object.cpp
index d5b512152..894668d4d 100644
--- a/src/script/api/script_object.cpp
+++ b/src/script/api/script_object.cpp
@@ -12,10 +12,12 @@
#include "../../stdafx.h"
#include "../../script/squirrel.hpp"
#include "../../command_func.h"
+#include "../../company_func.h"
#include "../../network/network.h"
#include "../../tunnelbridge.h"
#include "../script_storage.hpp"
+#include "../../ai/ai_config.hpp"
#include "../../ai/ai_instance.hpp"
#include "../script_fatalerror.hpp"
#include "../script_suspend.hpp"