summaryrefslogtreecommitdiff
path: root/src/script/api/script_controller.cpp
diff options
context:
space:
mode:
authorPatric Stout <truebrain@openttd.org>2020-12-25 14:44:28 +0100
committerPatric Stout <github@truebrain.nl>2020-12-25 17:03:44 +0100
commit29e3331055a784ead663b62a67ef13b0112af1df (patch)
tree887cd5c57c892dd40f44a1f0ee5dd7aca43a0c52 /src/script/api/script_controller.cpp
parent8c0e4ab07fdd01c0fe7eba9e74214289195cd238 (diff)
downloadopenttd-29e3331055a784ead663b62a67ef13b0112af1df.tar.xz
Codechange: move block a bit lower to increase readability
It was rather confusing that "library_name" was calculated, and then not used to do the FindLibrary() call. Flipping those two blocks around makes it a bit more sane to read.
Diffstat (limited to 'src/script/api/script_controller.cpp')
-rw-r--r--src/script/api/script_controller.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/script/api/script_controller.cpp b/src/script/api/script_controller.cpp
index 461a6c61b..adfcf2acd 100644
--- a/src/script/api/script_controller.cpp
+++ b/src/script/api/script_controller.cpp
@@ -111,11 +111,6 @@ ScriptController::~ScriptController()
Squirrel *engine = ScriptObject::GetActiveInstance()->engine;
HSQUIRRELVM vm = engine->GetVM();
- /* Internally we store libraries as 'library.version' */
- char library_name[1024];
- seprintf(library_name, lastof(library_name), "%s.%d", library, version);
- strtolower(library_name);
-
ScriptInfo *lib = ScriptObject::GetActiveInstance()->FindLibrary(library, version);
if (lib == nullptr) {
char error[1024];
@@ -123,6 +118,11 @@ ScriptController::~ScriptController()
throw sq_throwerror(vm, error);
}
+ /* Internally we store libraries as 'library.version' */
+ char library_name[1024];
+ seprintf(library_name, lastof(library_name), "%s.%d", library, version);
+ strtolower(library_name);
+
/* Get the current table/class we belong to */
HSQOBJECT parent;
sq_getstackobj(vm, 1, &parent);