Codechange: catch script exceptions by reference
This commit is contained in:
@@ -95,7 +95,7 @@ void ScriptInstance::Initialize(const char *main_script, const char *instance_na
|
||||
return;
|
||||
}
|
||||
ScriptObject::SetAllowDoCommand(true);
|
||||
} catch (Script_FatalError e) {
|
||||
} catch (Script_FatalError &e) {
|
||||
this->is_dead = true;
|
||||
this->engine->ThrowError(e.GetErrorMessage());
|
||||
this->engine->ResumeError();
|
||||
@@ -188,7 +188,7 @@ void ScriptInstance::GameLoop()
|
||||
}
|
||||
try {
|
||||
this->callback(this);
|
||||
} catch (Script_Suspend e) {
|
||||
} catch (Script_Suspend &e) {
|
||||
this->suspend = e.GetSuspendTime();
|
||||
this->callback = e.GetSuspendCallback();
|
||||
|
||||
@@ -218,10 +218,10 @@ void ScriptInstance::GameLoop()
|
||||
ScriptObject::SetAllowDoCommand(true);
|
||||
/* Start the script by calling Start() */
|
||||
if (!this->engine->CallMethod(*this->instance, "Start", _settings_game.script.script_max_opcode_till_suspend) || !this->engine->IsSuspended()) this->Died();
|
||||
} catch (Script_Suspend e) {
|
||||
} catch (Script_Suspend &e) {
|
||||
this->suspend = e.GetSuspendTime();
|
||||
this->callback = e.GetSuspendCallback();
|
||||
} catch (Script_FatalError e) {
|
||||
} catch (Script_FatalError &e) {
|
||||
this->is_dead = true;
|
||||
this->engine->ThrowError(e.GetErrorMessage());
|
||||
this->engine->ResumeError();
|
||||
@@ -239,10 +239,10 @@ void ScriptInstance::GameLoop()
|
||||
/* Continue the VM */
|
||||
try {
|
||||
if (!this->engine->Resume(_settings_game.script.script_max_opcode_till_suspend)) this->Died();
|
||||
} catch (Script_Suspend e) {
|
||||
} catch (Script_Suspend &e) {
|
||||
this->suspend = e.GetSuspendTime();
|
||||
this->callback = e.GetSuspendCallback();
|
||||
} catch (Script_FatalError e) {
|
||||
} catch (Script_FatalError &e) {
|
||||
this->is_dead = true;
|
||||
this->engine->ThrowError(e.GetErrorMessage());
|
||||
this->engine->ResumeError();
|
||||
@@ -496,7 +496,7 @@ void ScriptInstance::Save()
|
||||
this->engine->CrashOccurred();
|
||||
return;
|
||||
}
|
||||
} catch (Script_FatalError e) {
|
||||
} catch (Script_FatalError &e) {
|
||||
/* If we don't mark the script as dead here cleaning up the squirrel
|
||||
* stack could throw Script_FatalError again. */
|
||||
this->is_dead = true;
|
||||
|
Reference in New Issue
Block a user