Clear gsc hooks when scripts are freed + fixes
This commit is contained in:
parent
2166df1e8f
commit
ac9340fe3e
@ -92,7 +92,7 @@ namespace loadscreen
|
|||||||
void draw_loadscreen_title()
|
void draw_loadscreen_title()
|
||||||
{
|
{
|
||||||
auto x = -20.f;
|
auto x = -20.f;
|
||||||
auto y = 290.f;
|
auto y = 288.f;
|
||||||
auto h = 24.f;
|
auto h = 24.f;
|
||||||
auto w = 0.f;
|
auto w = 0.f;
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
#include "game/scripting/lua/value_conversion.hpp"
|
#include "game/scripting/lua/value_conversion.hpp"
|
||||||
#include "game/scripting/lua/error.hpp"
|
#include "game/scripting/lua/error.hpp"
|
||||||
#include "notifies.hpp"
|
#include "notifies.hpp"
|
||||||
|
#include "scripting.hpp"
|
||||||
|
|
||||||
#include <utils/hook.hpp>
|
#include <utils/hook.hpp>
|
||||||
|
|
||||||
@ -199,7 +200,18 @@ namespace notifies
|
|||||||
|
|
||||||
void clear_callbacks()
|
void clear_callbacks()
|
||||||
{
|
{
|
||||||
vm_execute_hooks.clear();
|
for (auto i = vm_execute_hooks.begin(); i != vm_execute_hooks.end();)
|
||||||
|
{
|
||||||
|
if (i->second.is_lua_hook)
|
||||||
|
{
|
||||||
|
i = vm_execute_hooks.erase(i);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
++i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
entity_damage_callbacks.clear();
|
entity_damage_callbacks.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -237,6 +249,14 @@ namespace notifies
|
|||||||
utils::hook::jump(0x1405C90A5, utils::hook::assemble(vm_execute_stub), true);
|
utils::hook::jump(0x1405C90A5, utils::hook::assemble(vm_execute_stub), true);
|
||||||
|
|
||||||
scr_entity_damage_hook.create(0x1404BD2E0, scr_entity_damage_stub);
|
scr_entity_damage_hook.create(0x1404BD2E0, scr_entity_damage_stub);
|
||||||
|
|
||||||
|
scripting::on_shutdown([](bool free_scripts)
|
||||||
|
{
|
||||||
|
if (free_scripts)
|
||||||
|
{
|
||||||
|
vm_execute_hooks.clear();
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -197,7 +197,8 @@ namespace scripting
|
|||||||
template <>
|
template <>
|
||||||
bool script_value::is<const char*>() const
|
bool script_value::is<const char*>() const
|
||||||
{
|
{
|
||||||
return this->get_raw().type == game::SCRIPT_STRING;
|
const auto type = this->get_raw().type;
|
||||||
|
return type == game::SCRIPT_STRING || type == game::SCRIPT_ISTRING;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
@ -215,7 +216,8 @@ namespace scripting
|
|||||||
template <>
|
template <>
|
||||||
std::string script_value::get() const
|
std::string script_value::get() const
|
||||||
{
|
{
|
||||||
return this->get<const char*>();
|
const auto localized = this->get_raw().type == game::SCRIPT_ISTRING;
|
||||||
|
return (localized ? "&"s : ""s) + this->get<const char*>();
|
||||||
}
|
}
|
||||||
|
|
||||||
/***************************************************************
|
/***************************************************************
|
||||||
|
Loading…
x
Reference in New Issue
Block a user