diff options
| author | Subv <s.v.h21@hotmail.com> | 2012-06-03 16:27:25 -0500 |
|---|---|---|
| committer | Subv <s.v.h21@hotmail.com> | 2012-06-03 16:27:25 -0500 |
| commit | c7cb120449d47bc9da69b8b65fa80272582d4371 (patch) | |
| tree | 12c6aa2cd06b2d2dd0c79fd5930ef09cac2cb8a5 | |
| parent | fa1375b7d66392279cdac94961344e5a3cc0f158 (diff) | |
Core/EventAI: Check AIName for EventAI scripts while loading them, avoid iterating again
| -rwxr-xr-x | src/server/game/AI/EventAI/CreatureEventAIMgr.cpp | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/src/server/game/AI/EventAI/CreatureEventAIMgr.cpp b/src/server/game/AI/EventAI/CreatureEventAIMgr.cpp index f95645611f1..448e43db316 100755 --- a/src/server/game/AI/EventAI/CreatureEventAIMgr.cpp +++ b/src/server/game/AI/EventAI/CreatureEventAIMgr.cpp @@ -204,12 +204,16 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() temp.raw.param3 = fields[8].GetInt32(); temp.raw.param4 = fields[9].GetInt32(); + CreatureTemplate* cInfo = sObjectMgr->GetCreatureTemplate(temp.creature_id); //Creature does not exist in database - if (!sObjectMgr->GetCreatureTemplate(temp.creature_id)) + if (!cInfo) { sLog->outErrorDb("CreatureEventAI: Event %u has script for non-existing creature entry (%u), skipping.", i, temp.creature_id); continue; } + + if (cInfo->AIName != "EventAI") + sLog->outErrorDb("Creature entry %u has EventAI scripts, but its AIName is not 'EventAI' - possible AI-mismatch?", temp.creature_id); //No chance of this event occuring if (temp.event_chance == 0) @@ -735,15 +739,6 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() } while (result->NextRow()); - for (CreatureEventAI_Event_Map::const_iterator itr = m_CreatureEventAI_Event_Map.begin(); itr != m_CreatureEventAI_Event_Map.end(); ++itr) - { - if (CreatureTemplate const* cInfo = sObjectMgr->GetCreatureTemplate(itr->first)) - { - if (cInfo->AIName != "EventAI") - sLog->outErrorDb("Creature entry %u has EventAI scripts, but its AIName is not 'EventAI' - possible AI-mismatch?", itr->first); - } - } - sLog->outString(">> Loaded %u CreatureEventAI scripts in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); sLog->outString(); } |
