(svn r26771) -Cleanup: remove OTTD2SQ and SQ2OTTD
This commit is contained in:
@@ -122,7 +122,7 @@ ScriptController::~ScriptController()
|
||||
if (lib == NULL) {
|
||||
char error[1024];
|
||||
seprintf(error, lastof(error), "couldn't find library '%s' with version %d", library, version);
|
||||
throw sq_throwerror(vm, OTTD2SQ(error));
|
||||
throw sq_throwerror(vm, error);
|
||||
}
|
||||
|
||||
/* Get the current table/class we belong to */
|
||||
@@ -142,13 +142,13 @@ ScriptController::~ScriptController()
|
||||
|
||||
/* Load the library in a 'fake' namespace, so we can link it to the name the user requested */
|
||||
sq_pushroottable(vm);
|
||||
sq_pushstring(vm, OTTD2SQ(fake_class), -1);
|
||||
sq_pushstring(vm, fake_class, -1);
|
||||
sq_newclass(vm, SQFalse);
|
||||
/* Load the library */
|
||||
if (!engine->LoadScript(vm, lib->GetMainScript(), false)) {
|
||||
char error[1024];
|
||||
seprintf(error, lastof(error), "there was a compile error when importing '%s' version %d", library, version);
|
||||
throw sq_throwerror(vm, OTTD2SQ(error));
|
||||
throw sq_throwerror(vm, error);
|
||||
}
|
||||
/* Create the fake class */
|
||||
sq_newslot(vm, -3, SQFalse);
|
||||
@@ -159,15 +159,15 @@ ScriptController::~ScriptController()
|
||||
|
||||
/* Find the real class inside the fake class (like 'sets.Vector') */
|
||||
sq_pushroottable(vm);
|
||||
sq_pushstring(vm, OTTD2SQ(fake_class), -1);
|
||||
sq_pushstring(vm, fake_class, -1);
|
||||
if (SQ_FAILED(sq_get(vm, -2))) {
|
||||
throw sq_throwerror(vm, _SC("internal error assigning library class"));
|
||||
}
|
||||
sq_pushstring(vm, OTTD2SQ(lib->GetInstanceName()), -1);
|
||||
sq_pushstring(vm, lib->GetInstanceName(), -1);
|
||||
if (SQ_FAILED(sq_get(vm, -2))) {
|
||||
char error[1024];
|
||||
seprintf(error, lastof(error), "unable to find class '%s' in the library '%s' version %d", lib->GetInstanceName(), library, version);
|
||||
throw sq_throwerror(vm, OTTD2SQ(error));
|
||||
throw sq_throwerror(vm, error);
|
||||
}
|
||||
HSQOBJECT obj;
|
||||
sq_getstackobj(vm, -1, &obj);
|
||||
@@ -177,7 +177,7 @@ ScriptController::~ScriptController()
|
||||
|
||||
/* Now link the name the user wanted to our 'fake' class */
|
||||
sq_pushobject(vm, parent);
|
||||
sq_pushstring(vm, OTTD2SQ(class_name), -1);
|
||||
sq_pushstring(vm, class_name, -1);
|
||||
sq_pushobject(vm, obj);
|
||||
sq_newclass(vm, SQTrue);
|
||||
sq_newslot(vm, -3, SQFalse);
|
||||
|
Reference in New Issue
Block a user