diff options
author | rubidium <rubidium@openttd.org> | 2014-05-25 19:53:46 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2014-05-25 19:53:46 +0000 |
commit | a6b4e59963561cefde5660c2ded9bd0b2801f2fc (patch) | |
tree | 02a3f5bca144d9046d265c3c371be385096dcb97 /src/script/script_scanner.cpp | |
parent | 105306609f967fbaf8342d1fb799a98d439a1a8f (diff) | |
download | openttd-a6b4e59963561cefde5660c2ded9bd0b2801f2fc.tar.xz |
(svn r26617) -Fix [FS#5973]: [Script] Loading/parsing of info .nuts was done in the same VM, causing e.g. constants to break the loading of info of other scripts
Diffstat (limited to 'src/script/script_scanner.cpp')
-rw-r--r-- | src/script/script_scanner.cpp | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/script/script_scanner.cpp b/src/script/script_scanner.cpp index 98bc1f385..57265669f 100644 --- a/src/script/script_scanner.cpp +++ b/src/script/script_scanner.cpp @@ -53,9 +53,9 @@ bool ScriptScanner::AddFile(const char *filename, size_t basepath_length, const if (!FioCheckFileExists(filename, this->subdir) || !FioCheckFileExists(this->main_script, this->subdir)) return false; - /* We don't care if one of the other scripts failed to load. */ - this->engine->ResetCrashed(); + this->ResetEngine(); this->engine->LoadScript(filename); + return true; } @@ -66,17 +66,20 @@ ScriptScanner::ScriptScanner() : { } +void ScriptScanner::ResetEngine() +{ + this->engine->Reset(); + this->engine->SetGlobalPointer(this); + this->RegisterAPI(this->engine); +} + void ScriptScanner::Initialize(const char *name) { this->engine = new Squirrel(name); - /* Mark this class as global pointer */ - this->engine->SetGlobalPointer(this); - - this->RegisterAPI(this->engine); this->RescanDir(); - this->engine->ResetCrashed(); + this->ResetEngine(); } ScriptScanner::~ScriptScanner() |