diff options
| -rwxr-xr-x | src/server/game/AI/CreatureAISelector.cpp | 2 | ||||
| -rwxr-xr-x | src/server/game/AI/EventAI/CreatureEventAIMgr.cpp | 19 |
2 files changed, 9 insertions, 12 deletions
diff --git a/src/server/game/AI/CreatureAISelector.cpp b/src/server/game/AI/CreatureAISelector.cpp index 46cbd1abf5d..f7e760c7b79 100755 --- a/src/server/game/AI/CreatureAISelector.cpp +++ b/src/server/game/AI/CreatureAISelector.cpp @@ -44,7 +44,7 @@ namespace FactorySelector // AIname in db std::string ainame=creature->GetAIName(); if (!ai_factory && !ainame.empty()) - ai_factory = ai_registry.GetRegistryItem(ainame.c_str()); + ai_factory = ai_registry.GetRegistryItem(ainame); // select by NPC flags if (!ai_factory) diff --git a/src/server/game/AI/EventAI/CreatureEventAIMgr.cpp b/src/server/game/AI/EventAI/CreatureEventAIMgr.cpp index d0f02fc37ff..c38b7159e5a 100755 --- a/src/server/game/AI/EventAI/CreatureEventAIMgr.cpp +++ b/src/server/game/AI/EventAI/CreatureEventAIMgr.cpp @@ -730,23 +730,20 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() m_CreatureEventAI_Event_Map[creature_id].push_back(temp); ++count; - if (CreatureTemplate const* cInfo = sObjectMgr->GetCreatureTemplate(temp.creature_id)) + } + 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.empty()) + 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"; } - if (cInfo->AIName.compare("EventAI")) - { - //sLog->outErrorDb("CreatureEventAI: Creature Entry %u has EventAI script but it has AIName %s. EventAI script will be overriden.", cInfo->Entry, cInfo->AIName); - } - if (cInfo->ScriptID) - { - //sLog->outErrorDb("CreatureEventAI: Creature Entry %u has EventAI script but it also has C++ script. EventAI script will be overriden.", cInfo->Entry); - } } } - while (result->NextRow()); sLog->outString(">> Loaded %u CreatureEventAI scripts in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); sLog->outString(); |
