[10896] Detect self-referenced model info in creature_model_info.

This commit is contained in:
VladimirMangos 2010-12-20 20:31:54 +03:00
parent e34d73f6bd
commit add4ceb999
2 changed files with 23 additions and 7 deletions

View file

@ -1022,18 +1022,34 @@ void ObjectMgr::LoadCreatureModelInfo()
const_cast<CreatureModelInfo*>(minfo)->gender = GENDER_MALE;
}
if (minfo->modelid_other_gender && !sCreatureDisplayInfoStore.LookupEntry(minfo->modelid_other_gender))
if (minfo->modelid_other_gender)
{
if (minfo->modelid_other_gender == minfo->modelid)
{
sLog.outErrorDb("Table `creature_model_info` has redundent modelid_other_gender model (%u) defined for model id %u.", minfo->modelid_other_gender, minfo->modelid);
const_cast<CreatureModelInfo*>(minfo)->modelid_other_gender = 0;
}
else if (!sCreatureDisplayInfoStore.LookupEntry(minfo->modelid_other_gender))
{
sLog.outErrorDb("Table `creature_model_info` has nonexistent modelid_other_gender model (%u) defined for model id %u.", minfo->modelid_other_gender, minfo->modelid);
const_cast<CreatureModelInfo*>(minfo)->modelid_other_gender = 0;
}
}
if (minfo->modelid_alternative && !sCreatureDisplayInfoStore.LookupEntry(minfo->modelid_alternative))
if (minfo->modelid_alternative)
{
if (minfo->modelid_alternative == minfo->modelid)
{
sLog.outErrorDb("Table `creature_model_info` has redundent modelid_alternative model (%u) defined for model id %u.", minfo->modelid_alternative, minfo->modelid);
const_cast<CreatureModelInfo*>(minfo)->modelid_alternative = 0;
}
else if (!sCreatureDisplayInfoStore.LookupEntry(minfo->modelid_alternative))
{
sLog.outErrorDb("Table `creature_model_info` has nonexistent modelid_alternative model (%u) defined for model id %u.", minfo->modelid_alternative, minfo->modelid);
const_cast<CreatureModelInfo*>(minfo)->modelid_alternative = 0;
}
}
}
// character races expected have model info data in table
for(uint32 race = 1; race < sChrRacesStore.GetNumRows(); ++race)

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "10895"
#define REVISION_NR "10896"
#endif // __REVISION_NR_H__