[7834] Mangos string loading code cleanups.

* Better integration creature event ai strings.
* Not inclide in checks as expected max mangos strings range value to range
This commit is contained in:
VladimirMangos 2009-05-15 16:49:35 +04:00
parent a1f4549862
commit 6aacc45ace
5 changed files with 57 additions and 31 deletions

View file

@ -36,7 +36,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Texts()
m_CreatureEventAI_TextMap.clear();
// Load EventAI Text
LoadMangosStrings(WorldDatabase,"creature_ai_texts",-1,1+(TEXT_SOURCE_RANGE));
objmgr.LoadMangosStrings(WorldDatabase,"creature_ai_texts",MIN_CREATURE_AI_TEXT_STRING_ID,MAX_CREATURE_AI_TEXT_STRING_ID);
// Gather Additional data from EventAI Texts
QueryResult *result = WorldDatabase.PQuery("SELECT entry, sound, type, language, emote FROM creature_ai_texts");
@ -59,15 +59,17 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Texts()
temp.Language = fields[3].GetInt32();
temp.Emote = fields[4].GetInt32();
if (i >= 0)
// range negative
if (i > MIN_CREATURE_AI_TEXT_STRING_ID || i <= MAX_CREATURE_AI_TEXT_STRING_ID)
{
sLog.outErrorDb("CreatureEventAI: Entry %i in table `creature_ai_texts` is not a negative value.",i);
sLog.outErrorDb("CreatureEventAI: Entry %i in table `creature_ai_texts` is not in valid range(%d-%d)",i,MIN_CREATURE_AI_TEXT_STRING_ID,MAX_CREATURE_AI_TEXT_STRING_ID);
continue;
}
if (i <= TEXT_SOURCE_RANGE)
// range negative (don't must be happen, loaded from same table)
if (!objmgr.GetMangosStringLocale(i))
{
sLog.outErrorDb("CreatureEventAI: Entry %i in table `creature_ai_texts` is out of accepted entry range for table.",i);
sLog.outErrorDb("CreatureEventAI: Entry %i in table `creature_ai_texts` not found",i);
continue;
}