mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Core/ScriptMgr: Replace IsDatabaseBound() methods through traits.
(cherry picked from commit 12d1993994)
This commit is contained in:
@@ -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).
|
||||
|
||||
Reference in New Issue
Block a user