diff options
author | rubidium <rubidium@openttd.org> | 2010-01-18 15:41:38 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2010-01-18 15:41:38 +0000 |
commit | b1bd1067032c51a8d88818488c924c82a8678454 (patch) | |
tree | baffff9722b0568418812cc9eff052edae02f715 /src/script/squirrel_helper.hpp | |
parent | a39a446e8faf99568eb8924535fd0034db00bb8e (diff) | |
download | openttd-b1bd1067032c51a8d88818488c924c82a8678454.tar.xz |
(svn r18862) -Fix [FS#3544]: don't pass AI strings through iconv
Diffstat (limited to 'src/script/squirrel_helper.hpp')
-rw-r--r-- | src/script/squirrel_helper.hpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/script/squirrel_helper.hpp b/src/script/squirrel_helper.hpp index 61b8f1a18..67f8a21ce 100644 --- a/src/script/squirrel_helper.hpp +++ b/src/script/squirrel_helper.hpp @@ -87,8 +87,8 @@ namespace SQConvert { template <> inline int Return<int64> (HSQUIRRELVM vm, int64 res) { sq_pushinteger(vm, ClampToI32(res)); return 1; } template <> inline int Return<Money> (HSQUIRRELVM vm, Money res) { sq_pushinteger(vm, ClampToI32(res)); return 1; } template <> inline int Return<bool> (HSQUIRRELVM vm, bool res) { sq_pushbool (vm, res); return 1; } - template <> inline int Return<char *> (HSQUIRRELVM vm, char *res) { if (res == NULL) sq_pushnull(vm); else { sq_pushstring(vm, OTTD2FS(res), -1); free(res); } return 1; } - template <> inline int Return<const char *>(HSQUIRRELVM vm, const char *res) { if (res == NULL) sq_pushnull(vm); else { sq_pushstring(vm, OTTD2FS(res), -1); } return 1; } + template <> inline int Return<char *> (HSQUIRRELVM vm, char *res) { if (res == NULL) sq_pushnull(vm); else { sq_pushstring(vm, OTTD2SQ(res), -1); free(res); } return 1; } + template <> inline int Return<const char *>(HSQUIRRELVM vm, const char *res) { if (res == NULL) sq_pushnull(vm); else { sq_pushstring(vm, OTTD2SQ(res), -1); } return 1; } template <> inline int Return<void *> (HSQUIRRELVM vm, void *res) { sq_pushuserpointer(vm, res); return 1; } /** @@ -109,7 +109,7 @@ namespace SQConvert { sq_tostring(vm, index); const SQChar *tmp; sq_getstring(vm, -1, &tmp); - char *tmp_str = strdup(FS2OTTD(tmp)); + char *tmp_str = strdup(SQ2OTTD(tmp)); sq_poptop(vm); *ptr->Append() = (void *)tmp_str; str_validate(tmp_str, tmp_str + strlen(tmp_str)); @@ -763,7 +763,7 @@ namespace SQConvert { /* Protect against calls to a non-static method in a static way */ sq_pushroottable(vm); - sq_pushstring(vm, OTTD2FS(Tcls::GetClassName()), -1); + sq_pushstring(vm, OTTD2SQ(Tcls::GetClassName()), -1); sq_get(vm, -2); sq_pushobject(vm, instance); if (sq_instanceof(vm) != SQTrue) return sq_throwerror(vm, _SC("class method is non-static")); @@ -805,7 +805,7 @@ namespace SQConvert { /* Protect against calls to a non-static method in a static way */ sq_pushroottable(vm); - sq_pushstring(vm, OTTD2FS(Tcls::GetClassName()), -1); + sq_pushstring(vm, OTTD2SQ(Tcls::GetClassName()), -1); sq_get(vm, -2); sq_pushobject(vm, instance); if (sq_instanceof(vm) != SQTrue) return sq_throwerror(vm, _SC("class method is non-static")); |