diff options
| author | Shauren <shauren.trinity@gmail.com> | 2017-05-12 18:49:51 +0200 |
|---|---|---|
| committer | Shauren <shauren.trinity@gmail.com> | 2017-05-12 18:50:27 +0200 |
| commit | 7e538980a2b4fc6c74bde7bd456633d954272708 (patch) | |
| tree | 73454d83035b0ddd099e4bc934222df60b66f597 /src/server/game/Scripting | |
| parent | 8fdf0778ca340d0bbf0e70dbf091d20c838981d3 (diff) | |
Core/Database: Include cleanup
Diffstat (limited to 'src/server/game/Scripting')
| -rw-r--r-- | src/server/game/Scripting/ScriptMgr.cpp | 15 | ||||
| -rw-r--r-- | src/server/game/Scripting/ScriptMgr.h | 7 |
2 files changed, 13 insertions, 9 deletions
diff --git a/src/server/game/Scripting/ScriptMgr.cpp b/src/server/game/Scripting/ScriptMgr.cpp index 9f912d95177..8b9312c84f2 100644 --- a/src/server/game/Scripting/ScriptMgr.cpp +++ b/src/server/game/Scripting/ScriptMgr.cpp @@ -2471,8 +2471,11 @@ UnitScript::UnitScript(const char* name, bool addToScripts) } WorldMapScript::WorldMapScript(const char* name, uint32 mapId) - : ScriptObject(name), MapScript<Map>(mapId) + : ScriptObject(name), MapScript<Map>(sMapStore.LookupEntry(mapId)) { + if (!GetEntry()) + TC_LOG_ERROR("scripts", "Invalid WorldMapScript for %u; no such map ID.", mapId); + if (GetEntry() && !GetEntry()->IsWorldMap()) TC_LOG_ERROR("scripts", "WorldMapScript for map %u is invalid.", mapId); @@ -2480,8 +2483,11 @@ WorldMapScript::WorldMapScript(const char* name, uint32 mapId) } InstanceMapScript::InstanceMapScript(const char* name, uint32 mapId) - : ScriptObject(name), MapScript<InstanceMap>(mapId) + : ScriptObject(name), MapScript<InstanceMap>(sMapStore.LookupEntry(mapId)) { + if (!GetEntry()) + TC_LOG_ERROR("scripts", "Invalid InstanceMapScript for %u; no such map ID.", mapId); + if (GetEntry() && !GetEntry()->IsDungeon()) TC_LOG_ERROR("scripts", "InstanceMapScript for map %u is invalid.", mapId); @@ -2489,8 +2495,11 @@ InstanceMapScript::InstanceMapScript(const char* name, uint32 mapId) } BattlegroundMapScript::BattlegroundMapScript(const char* name, uint32 mapId) - : ScriptObject(name), MapScript<BattlegroundMap>(mapId) + : ScriptObject(name), MapScript<BattlegroundMap>(sMapStore.LookupEntry(mapId)) { + if (!GetEntry()) + TC_LOG_ERROR("scripts", "Invalid BattlegroundMapScript for %u; no such map ID.", mapId); + if (GetEntry() && !GetEntry()->IsBattleground()) TC_LOG_ERROR("scripts", "BattlegroundMapScript for map %u is invalid.", mapId); diff --git a/src/server/game/Scripting/ScriptMgr.h b/src/server/game/Scripting/ScriptMgr.h index f4cbfff2c47..a42c3fd1f89 100644 --- a/src/server/game/Scripting/ScriptMgr.h +++ b/src/server/game/Scripting/ScriptMgr.h @@ -302,12 +302,7 @@ template<class TMap> class MapScript : public UpdatableScript<TMap> protected: - MapScript(uint32 mapId) - : _mapEntry(sMapStore.LookupEntry(mapId)) - { - if (!_mapEntry) - TC_LOG_ERROR("scripts", "Invalid MapScript for %u; no such map ID.", mapId); - } + MapScript(MapEntry const* mapEntry) : _mapEntry(mapEntry) { } public: |
