lua: fix enabling/disabling (#2745)
This commit is contained in:
parent
2d55470e10
commit
cde5563204
@ -180,10 +180,12 @@ namespace big
|
||||
const auto module_path = module->module_path();
|
||||
|
||||
// unload module
|
||||
{
|
||||
std::lock_guard guard(m_disabled_module_lock);
|
||||
std::erase_if(m_disabled_modules, [module_id](auto& module) {
|
||||
return module_id == module->module_id();
|
||||
});
|
||||
}
|
||||
|
||||
const auto new_module_path = move_file_relative_to_folder(m_disabled_scripts_folder.get_path(), m_scripts_folder.get_path(), module_path);
|
||||
if (new_module_path)
|
||||
@ -202,10 +204,12 @@ namespace big
|
||||
const auto module_path = module->module_path();
|
||||
|
||||
// unload module
|
||||
{
|
||||
std::lock_guard guard(m_disabled_module_lock);
|
||||
std::erase_if(m_modules, [module_id](auto& module) {
|
||||
return module_id == module->module_id();
|
||||
});
|
||||
}
|
||||
|
||||
const auto new_module_path = move_file_relative_to_folder(m_scripts_folder.get_path(), m_disabled_scripts_folder.get_path(), module_path);
|
||||
if (new_module_path)
|
||||
@ -219,10 +223,14 @@ namespace big
|
||||
void lua_manager::unload_module(rage::joaat_t module_id)
|
||||
{
|
||||
std::lock_guard guard(m_module_lock);
|
||||
|
||||
std::erase_if(m_modules, [module_id](auto& module) {
|
||||
return module_id == module->module_id();
|
||||
});
|
||||
|
||||
std::lock_guard guard2(m_disabled_module_lock);
|
||||
std::erase_if(m_disabled_modules, [module_id](auto& module) {
|
||||
return module_id == module->module_id();
|
||||
});
|
||||
}
|
||||
|
||||
std::weak_ptr<lua_module> lua_manager::load_module(const std::filesystem::path& module_path)
|
||||
|
Reference in New Issue
Block a user