diff options
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 760d6c3bf..7a4bf7e08 100644 --- a/src/script/squirrel_helper.hpp +++ b/src/script/squirrel_helper.hpp @@ -88,8 +88,8 @@ namespace SQConvert { template <> inline int Return<int64> (HSQUIRRELVM vm, int64 res) { sq_pushinteger(vm, res); return 1; } template <> inline int Return<Money> (HSQUIRRELVM vm, Money res) { sq_pushinteger(vm, 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, 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<char *> (HSQUIRRELVM vm, char *res) { if (res == NULL) sq_pushnull(vm); else { sq_pushstring(vm, 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, res, -1); } return 1; } template <> inline int Return<void *> (HSQUIRRELVM vm, void *res) { sq_pushuserpointer(vm, res); return 1; } template <> inline int Return<HSQOBJECT> (HSQUIRRELVM vm, HSQOBJECT res) { sq_pushobject(vm, res); return 1; } @@ -115,7 +115,7 @@ namespace SQConvert { const SQChar *tmp; sq_getstring(vm, -1, &tmp); - char *tmp_str = stredup(SQ2OTTD(tmp)); + char *tmp_str = stredup(tmp); sq_poptop(vm); *ptr->Append() = (void *)tmp_str; str_validate(tmp_str, tmp_str + strlen(tmp_str)); @@ -749,7 +749,7 @@ namespace SQConvert { /* Protect against calls to a non-static method in a static way */ sq_pushroottable(vm); const char *className = GetClassName<Tcls, Ttype>(); - sq_pushstring(vm, OTTD2SQ(className), -1); + sq_pushstring(vm, className, -1); sq_get(vm, -2); sq_pushobject(vm, instance); if (sq_instanceof(vm) != SQTrue) return sq_throwerror(vm, _SC("class method is non-static")); @@ -791,7 +791,7 @@ namespace SQConvert { /* Protect against calls to a non-static method in a static way */ sq_pushroottable(vm); const char *className = GetClassName<Tcls, Ttype>(); - sq_pushstring(vm, OTTD2SQ(className), -1); + sq_pushstring(vm, className, -1); sq_get(vm, -2); sq_pushobject(vm, instance); if (sq_instanceof(vm) != SQTrue) return sq_throwerror(vm, _SC("class method is non-static")); |