Skip to content

Commit

Permalink
Core/Scripting: Added missing hotswap code for SceneScripts
Browse files Browse the repository at this point in the history
  • Loading branch information
Traesh authored and joschiwald committed Jan 1, 2017
1 parent ab06ae7 commit 96f7ce4
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions src/server/game/Scripting/ScriptMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -662,6 +662,35 @@ class ScriptRegistrySwapHooks<InstanceMapScript, Base>
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>
Expand Down

0 comments on commit 96f7ce4

Please sign in to comment.