Revert "Merge branch 'master' into Playerbot"

This reverts commit 9973151927, reversing
changes made to 6f5b504e4c.
This commit is contained in:
Yunfan Li
2024-09-13 17:13:32 +08:00
parent 7e8c2d2887
commit 2358b256f2
32 changed files with 499 additions and 539 deletions

View File

@@ -30,9 +30,24 @@ namespace
template<typename T>
inline void SCR_CLEAR()
{
for (auto const& [scriptID, script] : ScriptRegistry<T>::ScriptPointerList)
for (auto& [scriptID, script] : ScriptRegistry<T>::ScriptPointerList)
{
delete script;
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);
}
}
ScriptRegistry<T>::ScriptPointerList.clear();