Checking of TrainerTemplateId fixed

The check for when the TrainerTemplateId is zero was missing.

Also, the world database revision has been updated in the revsion.h
file.
This commit is contained in:
Charles A Edwards 2016-09-04 08:37:04 +01:00 committed by Antz
parent 83a2c9a1a8
commit 95cee3b86c
2 changed files with 10 additions and 7 deletions

View file

@ -9408,27 +9408,30 @@ void ObjectMgr::LoadTrainerTemplates()
bool hasErrored = false; bool hasErrored = false;
for (CacheTrainerSpellMap::const_iterator tItr = m_mCacheTrainerTemplateSpellMap.begin(); tItr != m_mCacheTrainerTemplateSpellMap.end(); ++tItr) for (CacheTrainerSpellMap::const_iterator tItr = m_mCacheTrainerTemplateSpellMap.begin(); tItr != m_mCacheTrainerTemplateSpellMap.end(); ++tItr)
trainer_ids.insert(tItr->first); { trainer_ids.insert(tItr->first); }
for (uint32 i = 1; i < sCreatureStorage.GetMaxEntry(); ++i) for (uint32 i = 1; i < sCreatureStorage.GetMaxEntry(); ++i)
{ {
if (CreatureInfo const* cInfo = sCreatureStorage.LookupEntry<CreatureInfo>(i)) if (CreatureInfo const* cInfo = sCreatureStorage.LookupEntry<CreatureInfo>(i))
{ {
if (cInfo->TrainerTemplateId)
{
if (m_mCacheTrainerTemplateSpellMap.find(cInfo->TrainerTemplateId) != m_mCacheTrainerTemplateSpellMap.end()) if (m_mCacheTrainerTemplateSpellMap.find(cInfo->TrainerTemplateId) != m_mCacheTrainerTemplateSpellMap.end())
trainer_ids.erase(cInfo->TrainerTemplateId); { trainer_ids.erase(cInfo->TrainerTemplateId); }
else else
{ {
sLog.outErrorDb("Creature (Entry: %u) has TrainerTemplateId = %u for nonexistent trainer template", cInfo->Entry, cInfo->TrainerTemplateId); sLog.outErrorDb("Creature (Entry: %u) has TrainerTemplateId = %u for nonexistent trainer template", cInfo->Entry, cInfo->TrainerTemplateId);
hasErrored = true; hasErrored = true;
} }
}
} }
} }
for (std::set<uint32>::const_iterator tItr = trainer_ids.begin(); tItr != trainer_ids.end(); ++tItr) for (std::set<uint32>::const_iterator tItr = trainer_ids.begin(); tItr != trainer_ids.end(); ++tItr)
sLog.outErrorDb("Table `npc_trainer_template` has trainer template %u not used by any trainers ", *tItr); { sLog.outErrorDb("Table `npc_trainer_template` has trainer template %u not used by any trainers ", *tItr); }
if (hasErrored || !trainer_ids.empty()) // Append extra line in case of reported errors if (hasErrored || !trainer_ids.empty()) // Append extra line in case of reported errors
sLog.outString(); { sLog.outString(); }
} }
void ObjectMgr::LoadVendors(char const* tableName, bool isTemplates) void ObjectMgr::LoadVendors(char const* tableName, bool isTemplates)

View file

@ -37,7 +37,7 @@
#define CHAR_DB_UPDATE_DESCRIPTION "match_client_limits" #define CHAR_DB_UPDATE_DESCRIPTION "match_client_limits"
#define WORLD_DB_VERSION_NR 21 #define WORLD_DB_VERSION_NR 21
#define WORLD_DB_STRUCTURE_NR 3 #define WORLD_DB_STRUCTURE_NR 4
#define WORLD_DB_CONTENT_NR 0 #define WORLD_DB_CONTENT_NR 4
#define WORLD_DB_UPDATE_DESCRIPTION "script_binding populated" #define WORLD_DB_UPDATE_DESCRIPTION "start up error fixes"
#endif // __REVISION_H__ #endif // __REVISION_H__