summaryrefslogtreecommitdiff
path: root/src/script
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2014-09-06 17:46:56 +0000
committerrubidium <rubidium@openttd.org>2014-09-06 17:46:56 +0000
commit33ab50556760a84d6754235e553c68ada2f35a63 (patch)
tree4dba0c52f8fac85916ccdfabb29457a1d36d25e1 /src/script
parentc96026cd1fcd771017f43e897fc90dea81558941 (diff)
downloadopenttd-33ab50556760a84d6754235e553c68ada2f35a63.tar.xz
(svn r26774) -Cleanup [Squirrel]: remove _SC macro
Diffstat (limited to 'src/script')
-rw-r--r--src/script/api/script_admin.cpp4
-rw-r--r--src/script/api/script_controller.cpp2
-rw-r--r--src/script/api/script_list.cpp10
-rw-r--r--src/script/api/script_text.cpp8
-rw-r--r--src/script/script_info_dummy.cpp4
-rw-r--r--src/script/squirrel.cpp22
-rw-r--r--src/script/squirrel_helper.hpp12
7 files changed, 31 insertions, 31 deletions
diff --git a/src/script/api/script_admin.cpp b/src/script/api/script_admin.cpp
index f6c41387b..f66d9fc8a 100644
--- a/src/script/api/script_admin.cpp
+++ b/src/script/api/script_admin.cpp
@@ -126,10 +126,10 @@
/* static */ SQInteger ScriptAdmin::Send(HSQUIRRELVM vm)
{
- if (sq_gettop(vm) - 1 != 1) return sq_throwerror(vm, _SC("wrong number of parameters"));
+ if (sq_gettop(vm) - 1 != 1) return sq_throwerror(vm, "wrong number of parameters");
if (sq_gettype(vm, 2) != OT_TABLE) {
- return sq_throwerror(vm, _SC("ScriptAdmin::Send requires a table as first parameter. No data sent."));
+ return sq_throwerror(vm, "ScriptAdmin::Send requires a table as first parameter. No data sent.");
}
std::string json;
diff --git a/src/script/api/script_controller.cpp b/src/script/api/script_controller.cpp
index aca645c05..a42c8ede9 100644
--- a/src/script/api/script_controller.cpp
+++ b/src/script/api/script_controller.cpp
@@ -161,7 +161,7 @@ ScriptController::~ScriptController()
sq_pushroottable(vm);
sq_pushstring(vm, fake_class, -1);
if (SQ_FAILED(sq_get(vm, -2))) {
- throw sq_throwerror(vm, _SC("internal error assigning library class"));
+ throw sq_throwerror(vm, "internal error assigning library class");
}
sq_pushstring(vm, lib->GetInstanceName(), -1);
if (SQ_FAILED(sq_get(vm, -2))) {
diff --git a/src/script/api/script_list.cpp b/src/script/api/script_list.cpp
index a185e0d89..cd605a509 100644
--- a/src/script/api/script_list.cpp
+++ b/src/script/api/script_list.cpp
@@ -758,7 +758,7 @@ SQInteger ScriptList::_set(HSQUIRRELVM vm)
{
if (sq_gettype(vm, 2) != OT_INTEGER) return SQ_ERROR;
if (sq_gettype(vm, 3) != OT_INTEGER && sq_gettype(vm, 3) != OT_NULL) {
- return sq_throwerror(vm, _SC("you can only assign integers to this list"));
+ return sq_throwerror(vm, "you can only assign integers to this list");
}
SQInteger idx, val;
@@ -810,7 +810,7 @@ SQInteger ScriptList::Valuate(HSQUIRRELVM vm)
int nparam = sq_gettop(vm) - 1;
if (nparam < 1) {
- return sq_throwerror(vm, _SC("You need to give a least a Valuator as parameter to ScriptList::Valuate"));
+ return sq_throwerror(vm, "You need to give a least a Valuator as parameter to ScriptList::Valuate");
}
/* Make sure the valuator function is really a function, and not any
@@ -818,7 +818,7 @@ SQInteger ScriptList::Valuate(HSQUIRRELVM vm)
* first parameter they give. */
SQObjectType valuator_type = sq_gettype(vm, 2);
if (valuator_type != OT_CLOSURE && valuator_type != OT_NATIVECLOSURE) {
- return sq_throwerror(vm, _SC("parameter 1 has an invalid type (expected function)"));
+ return sq_throwerror(vm, "parameter 1 has an invalid type (expected function)");
}
/* Don't allow docommand from a Valuator, as we can't resume in
@@ -867,7 +867,7 @@ SQInteger ScriptList::Valuate(HSQUIRRELVM vm)
sq_pop(vm, nparam + 4);
ScriptObject::SetAllowDoCommand(backup_allow);
- return sq_throwerror(vm, _SC("return value of valuator is not valid (not integer/bool)"));
+ return sq_throwerror(vm, "return value of valuator is not valid (not integer/bool)");
}
}
@@ -877,7 +877,7 @@ SQInteger ScriptList::Valuate(HSQUIRRELVM vm)
sq_pop(vm, nparam + 4);
ScriptObject::SetAllowDoCommand(backup_allow);
- return sq_throwerror(vm, _SC("modifying valuated list outside of valuator function"));
+ return sq_throwerror(vm, "modifying valuated list outside of valuator function");
}
this->SetValue((*iter).first, value);
diff --git a/src/script/api/script_text.cpp b/src/script/api/script_text.cpp
index 0c2c0516b..51fc19863 100644
--- a/src/script/api/script_text.cpp
+++ b/src/script/api/script_text.cpp
@@ -34,13 +34,13 @@ ScriptText::ScriptText(HSQUIRRELVM vm) :
{
int nparam = sq_gettop(vm) - 1;
if (nparam < 1) {
- throw sq_throwerror(vm, _SC("You need to pass at least a StringID to the constructor"));
+ throw sq_throwerror(vm, "You need to pass at least a StringID to the constructor");
}
/* First resolve the StringID. */
SQInteger sqstring;
if (SQ_FAILED(sq_getinteger(vm, 2, &sqstring))) {
- throw sq_throwerror(vm, _SC("First argument must be a valid StringID"));
+ throw sq_throwerror(vm, "First argument must be a valid StringID");
}
this->string = sqstring;
@@ -51,7 +51,7 @@ ScriptText::ScriptText(HSQUIRRELVM vm) :
if (SQ_FAILED(this->_SetParam(i, vm))) {
this->~ScriptText();
- throw sq_throwerror(vm, _SC("Invalid parameter"));
+ throw sq_throwerror(vm, "Invalid parameter");
}
/* Pop the parameter again. */
@@ -104,7 +104,7 @@ SQInteger ScriptText::_SetParam(int parameter, HSQUIRRELVM vm)
/* Validate if it is a GSText instance */
sq_pushroottable(vm);
- sq_pushstring(vm, _SC("GSText"), -1);
+ sq_pushstring(vm, "GSText", -1);
sq_get(vm, -2);
sq_pushobject(vm, instance);
if (sq_instanceof(vm) != SQTrue) return SQ_ERROR;
diff --git a/src/script/script_info_dummy.cpp b/src/script/script_info_dummy.cpp
index 79190c82d..049e59342 100644
--- a/src/script/script_info_dummy.cpp
+++ b/src/script/script_info_dummy.cpp
@@ -46,7 +46,7 @@ void Script_CreateDummyInfo(HSQUIRRELVM vm, const char *type, const char *dir)
sq_pushroottable(vm);
/* Load and run the script */
- if (SQ_SUCCEEDED(sq_compilebuffer(vm, sq_dummy_script, scstrlen(sq_dummy_script), _SC("dummy"), SQTrue))) {
+ if (SQ_SUCCEEDED(sq_compilebuffer(vm, sq_dummy_script, scstrlen(sq_dummy_script), "dummy", SQTrue))) {
sq_push(vm, -2);
if (SQ_SUCCEEDED(sq_call(vm, 1, SQFalse, SQTrue))) {
sq_pop(vm, 1);
@@ -101,7 +101,7 @@ void Script_CreateDummy(HSQUIRRELVM vm, StringID string, const char *type)
/* And finally we load and run the script */
sq_pushroottable(vm);
- if (SQ_SUCCEEDED(sq_compilebuffer(vm, sq_dummy_script, scstrlen(sq_dummy_script), _SC("dummy"), SQTrue))) {
+ if (SQ_SUCCEEDED(sq_compilebuffer(vm, sq_dummy_script, scstrlen(sq_dummy_script), "dummy", SQTrue))) {
sq_push(vm, -2);
if (SQ_SUCCEEDED(sq_call(vm, 1, SQFalse, SQTrue))) {
sq_pop(vm, 1);
diff --git a/src/script/squirrel.cpp b/src/script/squirrel.cpp
index 44ae52348..dc71d1ef4 100644
--- a/src/script/squirrel.cpp
+++ b/src/script/squirrel.cpp
@@ -56,7 +56,7 @@ void Squirrel::ErrorPrintFunc(HSQUIRRELVM vm, const SQChar *s, ...)
/* Check if we have a custom print function */
SQPrintFunc *func = ((Squirrel *)sq_getforeignptr(vm))->print_func;
if (func == NULL) {
- scfprintf(stderr, _SC("%s"), buf);
+ scfprintf(stderr, "%s", buf);
} else {
(*func)(true, buf);
}
@@ -74,7 +74,7 @@ void Squirrel::RunError(HSQUIRRELVM vm, const SQChar *error)
Squirrel *engine = (Squirrel *)sq_getforeignptr(vm);
SQPrintFunc *func = engine->print_func;
if (func == NULL) {
- scfprintf(stderr, _SC("%s"), buf);
+ scfprintf(stderr, "%s", buf);
} else {
(*func)(true, buf);
}
@@ -96,7 +96,7 @@ SQInteger Squirrel::_RunError(HSQUIRRELVM vm)
}
}
- Squirrel::RunError(vm, _SC("unknown error"));
+ Squirrel::RunError(vm, "unknown error");
return 0;
}
@@ -108,12 +108,12 @@ void Squirrel::PrintFunc(HSQUIRRELVM vm, const SQChar *s, ...)
va_start(arglist, s);
scvsnprintf(buf, lengthof(buf) - 2, s, arglist);
va_end(arglist);
- scstrcat(buf, _SC("\n"));
+ scstrcat(buf, "\n");
/* Check if we have a custom print function */
SQPrintFunc *func = ((Squirrel *)sq_getforeignptr(vm))->print_func;
if (func == NULL) {
- scprintf(_SC("%s"), buf);
+ scprintf("%s", buf);
} else {
(*func)(false, buf);
}
@@ -478,14 +478,14 @@ SQRESULT Squirrel::LoadFile(HSQUIRRELVM vm, const char *filename, SQBool printer
case SQ_BYTECODE_STREAM_TAG: { // BYTECODE
if (fseek(file, -2, SEEK_CUR) < 0) {
FioFCloseFile(file);
- return sq_throwerror(vm, _SC("cannot seek the file"));
+ return sq_throwerror(vm, "cannot seek the file");
}
if (SQ_SUCCEEDED(sq_readclosure(vm, _io_file_read, &f))) {
FioFCloseFile(file);
return SQ_OK;
}
FioFCloseFile(file);
- return sq_throwerror(vm, _SC("Couldn't read bytecode"));
+ return sq_throwerror(vm, "Couldn't read bytecode");
}
case 0xFFFE:
/* Either this file is encoded as big-endian and we're on a little-endian
@@ -498,11 +498,11 @@ SQRESULT Squirrel::LoadFile(HSQUIRRELVM vm, const char *filename, SQBool printer
case 0xEFBB: // UTF-8 on big-endian machine
if (fread(&uc, 1, sizeof(uc), file) == 0) {
FioFCloseFile(file);
- return sq_throwerror(vm, _SC("I/O error"));
+ return sq_throwerror(vm, "I/O error");
}
if (uc != 0xBF) {
FioFCloseFile(file);
- return sq_throwerror(vm, _SC("Unrecognized encoding"));
+ return sq_throwerror(vm, "Unrecognized encoding");
}
func = _io_file_lexfeed_UTF8;
break;
@@ -510,7 +510,7 @@ SQRESULT Squirrel::LoadFile(HSQUIRRELVM vm, const char *filename, SQBool printer
func = _io_file_lexfeed_ASCII;
if (fseek(file, -2, SEEK_CUR) < 0) {
FioFCloseFile(file);
- return sq_throwerror(vm, _SC("cannot seek the file"));
+ return sq_throwerror(vm, "cannot seek the file");
}
break;
}
@@ -522,7 +522,7 @@ SQRESULT Squirrel::LoadFile(HSQUIRRELVM vm, const char *filename, SQBool printer
FioFCloseFile(file);
return SQ_ERROR;
}
- return sq_throwerror(vm, _SC("cannot open the file"));
+ return sq_throwerror(vm, "cannot open the file");
}
bool Squirrel::LoadScript(HSQUIRRELVM vm, const char *script, bool in_root)
diff --git a/src/script/squirrel_helper.hpp b/src/script/squirrel_helper.hpp
index 7a4bf7e08..22d738d4f 100644
--- a/src/script/squirrel_helper.hpp
+++ b/src/script/squirrel_helper.hpp
@@ -125,7 +125,7 @@ namespace SQConvert {
template <> inline Array *GetParam(ForceType<Array *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr)
{
/* Sanity check of the size. */
- if (sq_getsize(vm, index) > UINT16_MAX) throw sq_throwerror(vm, _SC("an array used as parameter to a function is too large"));
+ if (sq_getsize(vm, index) > UINT16_MAX) throw sq_throwerror(vm, "an array used as parameter to a function is too large");
SQObject obj;
sq_getstackobj(vm, index, &obj);
@@ -140,7 +140,7 @@ namespace SQConvert {
*data.Append() = (int32)tmp;
} else {
sq_pop(vm, 4);
- throw sq_throwerror(vm, _SC("a member of an array used as parameter to a function is not numeric"));
+ throw sq_throwerror(vm, "a member of an array used as parameter to a function is not numeric");
}
sq_pop(vm, 2);
@@ -752,14 +752,14 @@ namespace SQConvert {
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"));
+ if (sq_instanceof(vm) != SQTrue) return sq_throwerror(vm, "class method is non-static");
sq_pop(vm, 3);
/* Get the 'real' instance of this class */
sq_getinstanceup(vm, 1, &real_instance, 0);
/* Get the real function pointer */
sq_getuserdata(vm, nparam, &ptr, 0);
- if (real_instance == NULL) return sq_throwerror(vm, _SC("couldn't detect real instance of class for non-static call"));
+ if (real_instance == NULL) return sq_throwerror(vm, "couldn't detect real instance of class for non-static call");
/* Remove the userdata from the stack */
sq_pop(vm, 1);
@@ -794,14 +794,14 @@ namespace SQConvert {
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"));
+ if (sq_instanceof(vm) != SQTrue) return sq_throwerror(vm, "class method is non-static");
sq_pop(vm, 3);
/* Get the 'real' instance of this class */
sq_getinstanceup(vm, 1, &real_instance, 0);
/* Get the real function pointer */
sq_getuserdata(vm, nparam, &ptr, 0);
- if (real_instance == NULL) return sq_throwerror(vm, _SC("couldn't detect real instance of class for non-static call"));
+ if (real_instance == NULL) return sq_throwerror(vm, "couldn't detect real instance of class for non-static call");
/* Remove the userdata from the stack */
sq_pop(vm, 1);