From 7c4e9dd71d6f02f686c52551ccdcc27b89ef8025 Mon Sep 17 00:00:00 2001 From: rubidium Date: Sat, 6 Sep 2014 17:30:33 +0000 Subject: (svn r26771) -Cleanup: remove OTTD2SQ and SQ2OTTD --- src/script/script_instance.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'src/script/script_instance.cpp') 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 */ -- cgit v1.2.3-54-g00ecf