Changeset 123 for trunk/src/game/Creature.cpp
- Timestamp:
- 11/19/08 13:38:18 (17 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/game/Creature.cpp
r102 r123 95 95 } 96 96 97 uint32 CreatureInfo::GetRandomValidModelId() const 98 { 99 uint32 c = 0; 100 uint32 modelIDs[4]; 101 102 if (Modelid1) modelIDs[c++] = Modelid1; 103 if (Modelid2) modelIDs[c++] = Modelid2; 104 if (Modelid3) modelIDs[c++] = Modelid3; 105 if (Modelid4) modelIDs[c++] = Modelid4; 106 107 return ((c>0) ? modelIDs[urand(0,c-1)] : 0); 108 } 109 110 uint32 CreatureInfo::GetFirstValidModelId() const 111 { 112 if(Modelid1) return Modelid1; 113 if(Modelid2) return Modelid2; 114 if(Modelid3) return Modelid3; 115 if(Modelid4) return Modelid4; 116 return 0; 117 } 118 97 119 Creature::Creature() : 98 120 Unit(), i_AI(NULL), … … 188 210 m_creatureInfo = cinfo; // map mode related always 189 211 190 if (cinfo->DisplayID_A == 0 || cinfo->DisplayID_H == 0) // Cancel load if no model defined 191 { 192 sLog.outErrorDb("Creature (Entry: %u) has no model defined for Horde or Alliance in table `creature_template`, can't load. ",Entry); 212 // Cancel load if no model defined 213 if (!(cinfo->GetFirstValidModelId())) 214 { 215 sLog.outErrorDb("Creature (Entry: %u) has no model defined in table `creature_template`, can't load. ",Entry); 193 216 return false; 194 217 } … … 1117 1140 if(cinfo) 1118 1141 { 1119 if(displayId != cinfo->DisplayID_A && displayId != cinfo->DisplayID_H) 1120 { 1121 CreatureModelInfo const *minfo = objmgr.GetCreatureModelInfo(cinfo->DisplayID_A); 1122 if(!minfo || displayId != minfo->modelid_other_gender) 1123 { 1124 minfo = objmgr.GetCreatureModelInfo(cinfo->DisplayID_H); 1125 if(minfo && displayId == minfo->modelid_other_gender) 1126 displayId = 0; 1127 } 1128 else 1129 displayId = 0; 1130 } 1131 else 1132 displayId = 0; 1142 if(displayId == cinfo->Modelid1 || displayId == cinfo->Modelid2 || 1143 displayId == cinfo->Modelid3 || displayId == cinfo->Modelid4) displayId = 0; 1133 1144 } 1134 1145