Revert "Revert "Merge branch 'master' into Playerbot""

This reverts commit 2358b256f2.
This commit is contained in:
Yunfan Li
2024-09-17 23:14:42 +08:00
parent 57b7a6a4eb
commit 910848c51b
32 changed files with 529 additions and 489 deletions

View File

@@ -30,24 +30,9 @@ namespace
template<typename T>
inline void SCR_CLEAR()
{
for (auto& [scriptID, script] : ScriptRegistry<T>::ScriptPointerList)
for (auto const& [scriptID, script] : ScriptRegistry<T>::ScriptPointerList)
{
try
{
if(script)
{
delete script;
script = nullptr;
}
}
catch (const std::exception& e)
{
LOG_ERROR("scripts.unloading", "Failed to unload script {} with ID: {}. Error: {}", script->GetName(), scriptID, e.what());
}
catch (...)
{
LOG_ERROR("scripts.unloading", "Failed to unload script {} with ID: {}. Unknown error occurred.", script->GetName(), scriptID);
}
delete script;
}
ScriptRegistry<T>::ScriptPointerList.clear();