aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/AI/EventAI
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2012-07-04 22:20:21 +0200
committerShauren <shauren.trinity@gmail.com>2012-07-04 22:20:21 +0200
commited6f3e2deff55f913f9646db5f540b7704088478 (patch)
tree2212558564e685b43214a2ca80aea7014af8e200 /src/server/game/AI/EventAI
parent138375c0455fc0c7f1c2fc0e6b94930dea28ae9c (diff)
parentc3cb82b9263331ceaf68ebf69638ce3162b4a934 (diff)
Merge branch 'master' of github.com:TrinityCore/TrinityCore into 4.x
Diffstat (limited to 'src/server/game/AI/EventAI')
-rwxr-xr-xsrc/server/game/AI/EventAI/CreatureEventAIMgr.cpp21
1 files changed, 7 insertions, 14 deletions
diff --git a/src/server/game/AI/EventAI/CreatureEventAIMgr.cpp b/src/server/game/AI/EventAI/CreatureEventAIMgr.cpp
index 517e55af457..a863f2f89cf 100755
--- a/src/server/game/AI/EventAI/CreatureEventAIMgr.cpp
+++ b/src/server/game/AI/EventAI/CreatureEventAIMgr.cpp
@@ -204,12 +204,17 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
temp.raw.param3 = fields[8].GetInt32();
temp.raw.param4 = fields[9].GetInt32();
+ CreatureTemplate const* cInfo = sObjectMgr->GetCreatureTemplate(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);
+ sLog->outErrorDb("CreatureEventAI: Event %u has script for non-existing creature entry (%u), skipping.", i, creature_id);
continue;
}
+
+ // Only on the first script
+ if (cInfo->AIName != "EventAI" && m_CreatureEventAI_Event_Map[creature_id].empty())
+ 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,18 +740,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', changing to EventAI", itr->first);
- const_cast<CreatureTemplate*>(cInfo)->AIName = "EventAI";
- }
- }
- }
-
sLog->outString(">> Loaded %u CreatureEventAI scripts in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog->outString();
}