From 12d1993994b11785174c7caa7d7f9b5aa87d8411 Mon Sep 17 00:00:00 2001 From: Naios Date: Wed, 4 Nov 2015 20:22:25 +0100 Subject: Core/ScriptMgr: Replace IsDatabaseBound() methods through traits. --- src/server/game/Scripting/ScriptMgr.cpp | 56 ++++++++++++++++++++++++++++++++- 1 file changed, 55 insertions(+), 1 deletion(-) (limited to 'src/server/game/Scripting/ScriptMgr.cpp') 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 +struct is_script_database_bound + : std::false_type { }; + +template<> +struct is_script_database_bound + : std::true_type { }; + +template<> +struct is_script_database_bound + : std::true_type { }; + +template<> +struct is_script_database_bound + : std::true_type { }; + +template<> +struct is_script_database_bound + : std::true_type { }; + +template<> +struct is_script_database_bound + : std::true_type { }; + +template<> +struct is_script_database_bound + : std::true_type { }; + +template<> +struct is_script_database_bound + : std::true_type { }; + +template<> +struct is_script_database_bound + : std::true_type { }; + +template<> +struct is_script_database_bound + : std::true_type { }; + +template<> +struct is_script_database_bound + : std::true_type { }; + +template<> +struct is_script_database_bound + : std::true_type { }; + +template<> +struct is_script_database_bound + : std::true_type { }; + // This is the global static registry of scripts. template class ScriptRegistry @@ -71,7 +125,7 @@ class ScriptRegistry } } - if (script->IsDatabaseBound()) + if (is_script_database_bound::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). -- cgit v1.2.3