(svn r26771) -Cleanup: remove OTTD2SQ and SQ2OTTD

This commit is contained in:
rubidium
2014-09-06 17:30:33 +00:00
parent 3f9525ff0e
commit 7c4e9dd71d
13 changed files with 53 additions and 68 deletions

View File

@@ -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 */