Fix gsc crash
This commit is contained in:
parent
44c1a1ccd7
commit
0e056e6835
@ -772,9 +772,9 @@ namespace gsc
|
|||||||
command::execute(cmd);
|
command::execute(cmd);
|
||||||
});
|
});
|
||||||
|
|
||||||
scripting::on_shutdown([](int free_scripts)
|
scripting::on_shutdown([](bool free_scripts, bool post_shutdown)
|
||||||
{
|
{
|
||||||
if (free_scripts)
|
if (free_scripts && post_shutdown)
|
||||||
{
|
{
|
||||||
xsk::gsc::h2::resolver::cleanup();
|
xsk::gsc::h2::resolver::cleanup();
|
||||||
clear();
|
clear();
|
||||||
|
@ -250,7 +250,7 @@ namespace notifies
|
|||||||
|
|
||||||
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)
|
scripting::on_shutdown([](bool free_scripts, bool /*post_shutdown*/)
|
||||||
{
|
{
|
||||||
if (free_scripts)
|
if (free_scripts)
|
||||||
{
|
{
|
||||||
|
@ -52,7 +52,7 @@ namespace scripting
|
|||||||
std::string current_scriptfile;
|
std::string current_scriptfile;
|
||||||
unsigned int current_file_id{};
|
unsigned int current_file_id{};
|
||||||
|
|
||||||
std::vector<std::function<void(bool)>> shutdown_callbacks;
|
std::vector<std::function<void(bool, bool)>> shutdown_callbacks;
|
||||||
|
|
||||||
std::unordered_map<unsigned int, std::string> canonical_string_table;
|
std::unordered_map<unsigned int, std::string> canonical_string_table;
|
||||||
|
|
||||||
@ -113,12 +113,17 @@ namespace scripting
|
|||||||
|
|
||||||
for (const auto& callback : shutdown_callbacks)
|
for (const auto& callback : shutdown_callbacks)
|
||||||
{
|
{
|
||||||
callback(free_scripts);
|
callback(free_scripts, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
clear_scheduled_notifies();
|
clear_scheduled_notifies();
|
||||||
lua::engine::stop();
|
lua::engine::stop();
|
||||||
g_shutdown_game_hook.invoke<void>(free_scripts);
|
g_shutdown_game_hook.invoke<void>(free_scripts);
|
||||||
|
|
||||||
|
for (const auto& callback : shutdown_callbacks)
|
||||||
|
{
|
||||||
|
callback(free_scripts, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void scr_add_class_field_stub(unsigned int classnum, game::scr_string_t name, unsigned int canonicalString, unsigned int offset)
|
void scr_add_class_field_stub(unsigned int classnum, game::scr_string_t name, unsigned int canonicalString, unsigned int offset)
|
||||||
@ -298,7 +303,7 @@ namespace scripting
|
|||||||
return scripting::find_token_single(id);
|
return scripting::find_token_single(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
void on_shutdown(const std::function<void(bool)>& callback)
|
void on_shutdown(const std::function<void(bool, bool)>& callback)
|
||||||
{
|
{
|
||||||
shutdown_callbacks.push_back(callback);
|
shutdown_callbacks.push_back(callback);
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@ namespace scripting
|
|||||||
|
|
||||||
extern std::string current_file;
|
extern std::string current_file;
|
||||||
|
|
||||||
void on_shutdown(const std::function<void(bool)>& callback);
|
void on_shutdown(const std::function<void(bool, bool)>& callback);
|
||||||
std::optional<std::string> get_canonical_string(const unsigned int id);
|
std::optional<std::string> get_canonical_string(const unsigned int id);
|
||||||
std::string get_token_single(unsigned int id);
|
std::string get_token_single(unsigned int id);
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user