Core/ObjectMgr: Move some npc_spellclick_spells and vehicle_accessory related errors to startup instead of post-startup runtime

This commit is contained in:
Machiavelli
2011-03-06 11:12:19 +01:00
parent df97ce7625
commit 6c4a0354a2
5 changed files with 27 additions and 10 deletions
+20 -1
View File
@@ -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();
}