diff options
author | Machiavelli <machiavelli.trinity@gmail.com> | 2011-03-06 11:12:19 +0100 |
---|---|---|
committer | Machiavelli <machiavelli.trinity@gmail.com> | 2011-03-06 11:12:19 +0100 |
commit | 6c4a0354a27e3149244a892cbcc1a2ed5922a06d (patch) | |
tree | 4b0009cb318bac9f8e9e82d15439d10389bc207f /src/server/game/Globals/ObjectMgr.cpp | |
parent | df97ce76258959a02e52fde2819d603234115b33 (diff) |
Core/ObjectMgr: Move some npc_spellclick_spells and vehicle_accessory related errors to startup instead of post-startup runtime
Diffstat (limited to 'src/server/game/Globals/ObjectMgr.cpp')
-rwxr-xr-x | src/server/game/Globals/ObjectMgr.cpp | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index 280dc734182..48cca2df14b 100755 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -2758,7 +2758,6 @@ void ObjectMgr::LoadVehicleAccessories() return; } - do { Field *fields = result->Fetch(); @@ -2782,6 +2781,12 @@ void ObjectMgr::LoadVehicleAccessories() continue; } + if (mSpellClickInfoMap.find(uiEntry) == mSpellClickInfoMap.end()) + { + sLog->outErrorDb("Table `vehicle_accessory`: creature template entry %u has no data in npc_spellclick_spells", uiEntry); + continue; + } + m_VehicleAccessoryMap[uiEntry].push_back(VehicleAccessory(uiAccessory, uiSeat, bMinion, uiSummonType, uiSummonTimer)); ++count; @@ -7692,6 +7697,20 @@ void ObjectMgr::LoadNPCSpellClickSpells() } while (result->NextRow()); + // all spellclick data loaded, now we check if there are creatures with NPC_FLAG_SPELLCLICK but with no data + // NOTE: It *CAN* be the other way around: no spellclick flag but with spellclick data, in case of creature-only vehicle accessories + for (uint32 i = 0; i < sCreatureStorage.MaxEntry; ++i) + { + if (CreatureInfo const* cInfo = GetCreatureTemplate(i)) + { + if ((cInfo->npcflag & UNIT_NPC_FLAG_SPELLCLICK) && mSpellClickInfoMap.find(i) == mSpellClickInfoMap.end()) + { + sLog->outErrorDb("npc_spellclick_spells: Creature template %u has UNIT_NPC_FLAG_SPELLCLICK but no data in spellclick table! Removing flag", i); + const_cast<CreatureInfo*>(cInfo)->npcflag &= ~UNIT_NPC_FLAG_SPELLCLICK; + } + } + } + sLog->outString(">> Loaded %u spellclick definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); sLog->outString(); } |