summaryrefslogtreecommitdiff
path: root/src/script/script_instance.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2014-09-06 17:30:33 +0000
committerrubidium <rubidium@openttd.org>2014-09-06 17:30:33 +0000
commit7c4e9dd71d6f02f686c52551ccdcc27b89ef8025 (patch)
tree7556a992183a12029525bf9ed3f6be8ced9d9dc8 /src/script/script_instance.cpp
parent3f9525ff0ecb5a12ca8635b88691154c293c4d8f (diff)
downloadopenttd-7c4e9dd71d6f02f686c52551ccdcc27b89ef8025.tar.xz
(svn r26771) -Cleanup: remove OTTD2SQ and SQ2OTTD
Diffstat (limited to 'src/script/script_instance.cpp')
-rw-r--r--src/script/script_instance.cpp13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/script/script_instance.cpp b/src/script/script_instance.cpp
index 9cfe05c49..f5039ffbc 100644
--- a/src/script/script_instance.cpp
+++ b/src/script/script_instance.cpp
@@ -46,7 +46,7 @@ ScriptStorage::~ScriptStorage()
static void PrintFunc(bool error_msg, const SQChar *message)
{
/* Convert to OpenTTD internal capable string */
- ScriptController::Print(error_msg, SQ2OTTD(message));
+ ScriptController::Print(error_msg, message);
}
ScriptInstance::ScriptInstance(const char *APIName) :
@@ -367,11 +367,8 @@ static const SaveLoad _script_byte[] = {
_script_sl_byte = SQSL_STRING;
SlObject(NULL, _script_byte);
}
- const SQChar *res;
- sq_getstring(vm, index, &res);
- /* @bug if a string longer than 512 characters is given to SQ2OTTD, the
- * internal buffer overflows. */
- const char *buf = SQ2OTTD(res);
+ const SQChar *buf;
+ sq_getstring(vm, index, &buf);
size_t len = strlen(buf) + 1;
if (len >= 255) {
ScriptLog::Error("Maximum string length is 254 chars. No data saved.");
@@ -569,7 +566,7 @@ bool ScriptInstance::IsPaused()
SlObject(NULL, _script_byte);
static char buf[256];
SlArray(buf, _script_sl_byte, SLE_CHAR);
- if (vm != NULL) sq_pushstring(vm, OTTD2SQ(buf), -1);
+ if (vm != NULL) sq_pushstring(vm, buf, -1);
return true;
}
@@ -658,7 +655,7 @@ bool ScriptInstance::CallLoad()
/* Go to the instance-root */
sq_pushobject(vm, *this->instance);
/* Find the function-name inside the script */
- sq_pushstring(vm, OTTD2SQ("Load"), -1);
+ sq_pushstring(vm, "Load", -1);
/* Change the "Load" string in a function pointer */
sq_get(vm, -2);
/* Push the main instance as "this" object */