Core/EventAI: Added a db error log to EventAI loading when AIName is not set properly (we don't like stealth changes to loaded data)

This commit is contained in:
Shauren
2011-07-04 18:58:52 +02:00
parent 9ed52dc646
commit 07f3da9426
2 changed files with 9 additions and 12 deletions
+1 -1
View File
@@ -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)
@@ -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();