Codechange: introduce and use std::string variant of sq_throwerror

This commit is contained in:
Rubidium
2023-05-06 00:04:10 +02:00
committed by rubidium42
parent 3453c03a17
commit e035705239
6 changed files with 18 additions and 32 deletions

View File

@@ -101,7 +101,7 @@ void ScriptInstance::Initialize(const char *main_script, const char *instance_na
ScriptObject::SetAllowDoCommand(true);
} catch (Script_FatalError &e) {
this->is_dead = true;
this->engine->ThrowError(e.GetErrorMessage().c_str());
this->engine->ThrowError(e.GetErrorMessage());
this->engine->ResumeError();
this->Died();
}
@@ -226,7 +226,7 @@ void ScriptInstance::GameLoop()
this->callback = e.GetSuspendCallback();
} catch (Script_FatalError &e) {
this->is_dead = true;
this->engine->ThrowError(e.GetErrorMessage().c_str());
this->engine->ThrowError(e.GetErrorMessage());
this->engine->ResumeError();
this->Died();
}
@@ -247,7 +247,7 @@ void ScriptInstance::GameLoop()
this->callback = e.GetSuspendCallback();
} catch (Script_FatalError &e) {
this->is_dead = true;
this->engine->ThrowError(e.GetErrorMessage().c_str());
this->engine->ThrowError(e.GetErrorMessage());
this->engine->ResumeError();
this->Died();
}
@@ -505,7 +505,7 @@ void ScriptInstance::Save()
/* If we don't mark the script as dead here cleaning up the squirrel
* stack could throw Script_FatalError again. */
this->is_dead = true;
this->engine->ThrowError(e.GetErrorMessage().c_str());
this->engine->ThrowError(e.GetErrorMessage());
this->engine->ResumeError();
SaveEmpty();
/* We can't kill the script here, so mark it as crashed (not dead) and