Fix setjmp

This commit is contained in:
Federico Cecchetto 2021-11-15 22:06:44 +01:00
parent 0f92a7ce25
commit e6ca925562
3 changed files with 4 additions and 8 deletions

View File

@ -109,8 +109,6 @@ namespace userinfo
gsc::method::add("resetname", [](const game::scr_entref_t ent, const gsc::function_args& args) -> scripting::script_value
{
const auto name = args[0].as<std::string>();
if (ent.classnum != 0 || ent.entnum > 17)
{
throw std::runtime_error("Invalid entity");
@ -141,8 +139,6 @@ namespace userinfo
gsc::method::add("resetclantag", [](const game::scr_entref_t ent, const gsc::function_args& args) -> scripting::script_value
{
const auto name = args[0].as<std::string>();
if (ent.classnum != 0 || ent.entnum > 17)
{
throw std::runtime_error("Invalid entity");

View File

@ -25,7 +25,7 @@ namespace scripting::safe_execution
bool call(const script_function function, const game::scr_entref_t& entref)
{
*game::g_script_error_level += 1;
if (game::_setjmp(&game::g_script_error[*game::g_script_error_level]))
if (game::_setjmp(&game::g_script_error[*game::g_script_error_level], 0, 0, 0))
{
*game::g_script_error_level -= 1;
return false;
@ -39,7 +39,7 @@ namespace scripting::safe_execution
bool set_entity_field(const game::scr_entref_t& entref, const int offset)
{
*game::g_script_error_level += 1;
if (game::_setjmp(&game::g_script_error[*game::g_script_error_level]))
if (game::_setjmp(&game::g_script_error[*game::g_script_error_level], 0, 0, 0))
{
*game::g_script_error_level -= 1;
return false;
@ -54,7 +54,7 @@ namespace scripting::safe_execution
bool get_entity_field(const game::scr_entref_t& entref, const int offset, game::VariableValue* value)
{
*game::g_script_error_level += 1;
if (game::_setjmp(&game::g_script_error[*game::g_script_error_level]))
if (game::_setjmp(&game::g_script_error[*game::g_script_error_level], 0, 0, 0))
{
value->type = game::SCRIPT_NONE;
value->u.intValue = 0;

View File

@ -62,7 +62,7 @@ namespace game
WEAK symbol<unsigned int(unsigned int localId, const char* pos, unsigned int paramcount)> VM_Execute{0x56DFE0};
WEAK symbol<void* (jmp_buf* Buf, int Value)> longjmp{0x7363BC};
WEAK symbol<int(jmp_buf* Buf)> _setjmp{0x734CF8};
WEAK symbol<int(jmp_buf* Buf, int a2, int a3, int a4)> _setjmp{0x734CF8};
// Variables