diff options
author | Naios <naios-dev@live.de> | 2015-11-04 20:22:25 +0100 |
---|---|---|
committer | Naios <naios-dev@live.de> | 2015-11-04 20:51:56 +0100 |
commit | 12d1993994b11785174c7caa7d7f9b5aa87d8411 (patch) | |
tree | 1e61d2375fce9d978de774dcd3b909d8df11c0f2 /src/server/game/Scripting/ScriptMgr.cpp | |
parent | 188bee6757949ddf70e2ccd25139765e0d7bfe97 (diff) |
Core/ScriptMgr: Replace IsDatabaseBound() methods through traits.
Diffstat (limited to 'src/server/game/Scripting/ScriptMgr.cpp')
-rw-r--r-- | src/server/game/Scripting/ScriptMgr.cpp | 56 |
1 files changed, 55 insertions, 1 deletions
diff --git a/src/server/game/Scripting/ScriptMgr.cpp b/src/server/game/Scripting/ScriptMgr.cpp index 0267061bc69..301a25fa6a4 100644 --- a/src/server/game/Scripting/ScriptMgr.cpp +++ b/src/server/game/Scripting/ScriptMgr.cpp @@ -41,6 +41,60 @@ UnusedScriptNamesContainer UnusedScriptNames; // } +// Trait which indicates whether this script type +// must be assigned in the database. +template<typename> +struct is_script_database_bound + : std::false_type { }; + +template<> +struct is_script_database_bound<SpellScriptLoader> + : std::true_type { }; + +template<> +struct is_script_database_bound<InstanceMapScript> + : std::true_type { }; + +template<> +struct is_script_database_bound<ItemScript> + : std::true_type { }; + +template<> +struct is_script_database_bound<CreatureScript> + : std::true_type { }; + +template<> +struct is_script_database_bound<GameObjectScript> + : std::true_type { }; + +template<> +struct is_script_database_bound<AreaTriggerScript> + : std::true_type { }; + +template<> +struct is_script_database_bound<BattlegroundScript> + : std::true_type { }; + +template<> +struct is_script_database_bound<OutdoorPvPScript> + : std::true_type { }; + +template<> +struct is_script_database_bound<WeatherScript> + : std::true_type { }; + +template<> +struct is_script_database_bound<ConditionScript> + : std::true_type { }; + +template<> +struct is_script_database_bound<TransportScript> + : std::true_type { }; + +template<> +struct is_script_database_bound<AchievementCriteriaScript> + : std::true_type { }; + // This is the global static registry of scripts. template<class TScript> class ScriptRegistry @@ -71,7 +125,7 @@ class ScriptRegistry } } - if (script->IsDatabaseBound()) + if (is_script_database_bound<TScript>::value) { // Get an ID for the script. An ID only exists if it's a script that is assigned in the database // through a script name (or similar). |