(svn r18862) -Fix [FS#3544]: don't pass AI strings through iconv

This commit is contained in:
rubidium
2010-01-18 15:41:38 +00:00
parent a39a446e8f
commit b1bd106703
9 changed files with 43 additions and 39 deletions

View File

@@ -90,7 +90,7 @@ AIStorage::~AIStorage()
static void PrintFunc(bool error_msg, const SQChar *message)
{
/* Convert to OpenTTD internal capable string */
AIController::Print(error_msg, FS2OTTD(message));
AIController::Print(error_msg, SQ2OTTD(message));
}
AIInstance::AIInstance(AIInfo *info) :
@@ -493,9 +493,9 @@ enum {
}
const SQChar *res;
sq_getstring(vm, index, &res);
/* @bug if a string longer than 512 characters is given to FS2OTTD, the
/* @bug if a string longer than 512 characters is given to SQ2OTTD, the
* internal buffer overflows. */
const char *buf = FS2OTTD(res);
const char *buf = SQ2OTTD(res);
size_t len = strlen(buf) + 1;
if (len >= 255) {
AILog::Error("Maximum string length is 254 chars. No data saved.");
@@ -673,7 +673,7 @@ void AIInstance::Save()
SlObject(NULL, _ai_byte);
static char buf[256];
SlArray(buf, _ai_sl_byte, SLE_CHAR);
if (vm != NULL) sq_pushstring(vm, OTTD2FS(buf), -1);
if (vm != NULL) sq_pushstring(vm, OTTD2SQ(buf), -1);
return true;
}
@@ -760,7 +760,7 @@ bool AIInstance::CallLoad()
/* Go to the instance-root */
sq_pushobject(vm, *this->instance);
/* Find the function-name inside the script */
sq_pushstring(vm, OTTD2FS("Load"), -1);
sq_pushstring(vm, OTTD2SQ("Load"), -1);
/* Change the "Load" string in a function pointer */
sq_get(vm, -2);
/* Push the main instance as "this" object */