From e6ca9255625b31d9a8033ed1f5b87eb19681dfd4 Mon Sep 17 00:00:00 2001 From: Federico Cecchetto Date: Mon, 15 Nov 2021 22:06:44 +0100 Subject: [PATCH] Fix setjmp --- src/component/userinfo.cpp | 4 ---- src/game/scripting/safe_execution.cpp | 6 +++--- src/game/symbols.hpp | 2 +- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/component/userinfo.cpp b/src/component/userinfo.cpp index 498fdfc..82436ae 100644 --- a/src/component/userinfo.cpp +++ b/src/component/userinfo.cpp @@ -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(); - 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(); - if (ent.classnum != 0 || ent.entnum > 17) { throw std::runtime_error("Invalid entity"); diff --git a/src/game/scripting/safe_execution.cpp b/src/game/scripting/safe_execution.cpp index 55e2421..de997c4 100644 --- a/src/game/scripting/safe_execution.cpp +++ b/src/game/scripting/safe_execution.cpp @@ -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; diff --git a/src/game/symbols.hpp b/src/game/symbols.hpp index e3e50fb..84a58e3 100644 --- a/src/game/symbols.hpp +++ b/src/game/symbols.hpp @@ -62,7 +62,7 @@ namespace game WEAK symbol VM_Execute{0x56DFE0}; WEAK symbol longjmp{0x7363BC}; - WEAK symbol _setjmp{0x734CF8}; + WEAK symbol _setjmp{0x734CF8}; // Variables