From add4ceb9994b59d54e94a832f1fdeba97dc7e004 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Mon, 20 Dec 2010 20:31:54 +0300 Subject: [PATCH] [10896] Detect self-referenced model info in `creature_model_info`. --- src/game/ObjectMgr.cpp | 28 ++++++++++++++++++++++------ src/shared/revision_nr.h | 2 +- 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index bd044a1aa..46c6f01fa 100644 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -1022,16 +1022,32 @@ void ObjectMgr::LoadCreatureModelInfo() const_cast(minfo)->gender = GENDER_MALE; } - if (minfo->modelid_other_gender && !sCreatureDisplayInfoStore.LookupEntry(minfo->modelid_other_gender)) + if (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(minfo)->modelid_other_gender = 0; + 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(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(minfo)->modelid_other_gender = 0; + } } - if (minfo->modelid_alternative && !sCreatureDisplayInfoStore.LookupEntry(minfo->modelid_alternative)) + if (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(minfo)->modelid_alternative = 0; + 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(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(minfo)->modelid_alternative = 0; + } } } diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 358c1ef74..c2f907043 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "10895" + #define REVISION_NR "10896" #endif // __REVISION_NR_H__