mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-15 23:20:36 +01:00
Core/Scripting: Added missing hotswap code for SceneScripts
This commit is contained in:
@@ -662,6 +662,35 @@ private:
|
||||
bool swapped;
|
||||
};
|
||||
|
||||
/// This hook is responsible for swapping SceneScript's
|
||||
template<typename Base>
|
||||
class ScriptRegistrySwapHooks<SceneScript, Base>
|
||||
: public ScriptRegistrySwapHookBase
|
||||
{
|
||||
public:
|
||||
ScriptRegistrySwapHooks() : swapped(false) { }
|
||||
|
||||
void BeforeReleaseContext(std::string const& context) final override
|
||||
{
|
||||
auto const bounds = static_cast<Base*>(this)->_ids_of_contexts.equal_range(context);
|
||||
if (bounds.first != bounds.second)
|
||||
swapped = true;
|
||||
}
|
||||
|
||||
void BeforeSwapContext(bool /*initialize*/) override
|
||||
{
|
||||
swapped = false;
|
||||
}
|
||||
|
||||
void BeforeUnload() final override
|
||||
{
|
||||
ASSERT(!swapped);
|
||||
}
|
||||
|
||||
private:
|
||||
bool swapped;
|
||||
};
|
||||
|
||||
/// This hook is responsible for swapping SpellScriptLoader's
|
||||
template<typename Base>
|
||||
class ScriptRegistrySwapHooks<SpellScriptLoader, Base>
|
||||
|
||||
Reference in New Issue
Block a user