[8811] check creature existance at waypoint loading

also just set the spellid to 0 if it doesn't exist
instead of dorpping the whole movementpoint
This commit is contained in:
balrok 2009-11-13 20:48:08 +01:00
parent 25ab89ce97
commit 33c6241fd8
2 changed files with 13 additions and 4 deletions

View file

@ -83,7 +83,10 @@ void WaypointManager::Load()
sLog.outString( ">> Paths loaded" );
}
result = WorldDatabase.Query("SELECT position_x, position_y, position_z, orientation, model1, model2, waittime, emote, spell, textid1, textid2, textid3, textid4, textid5, id, point FROM creature_movement");
// 0 1 2 3 4 5
result = WorldDatabase.Query("SELECT position_x, position_y, position_z, orientation, model1, model2,"
// 6 7 8 9 10 11 12 13 14 15
"waittime, emote, spell, textid1, textid2, textid3, textid4, textid5, id, point FROM creature_movement");
barGoLink bar( result->GetRowCount() );
do
@ -92,6 +95,12 @@ void WaypointManager::Load()
Field *fields = result->Fetch();
uint32 point = fields[15].GetUInt32();
uint32 id = fields[14].GetUInt32();
if (!sObjectMgr.GetCreatureData(id))
{
sLog.outErrorDb("Table creature_movement references unknown creature %u. Skipping.", id);
continue;
}
WaypointPath &path = m_pathMap[id];
// the cleanup queries make sure the following is true
assert(point >= 1 && point <= path.size());
@ -143,8 +152,8 @@ void WaypointManager::Load()
if (be.spell && ! sSpellStore.LookupEntry(be.spell))
{
sLog.outErrorDb("Table creature_movement references unknown spellid %u. Skipping id %u.", be.spell, id);
continue;
sLog.outErrorDb("Table creature_movement references unknown spellid %u. Skipping id %u with point %u.", be.spell, id, point);
be.spell = 0;
}
if (be.emote)