Show
Ignore:
Timestamp:
11/19/08 13:38:18 (17 years ago)
Author:
yumileroy
Message:

[svn] * Changed modelid_a/h(2) values to modelid1..4, display ids are no longer incorrectly chosen based on player faction. Patch provided by WarHead?.

Original author: w12x
Date: 2008-10-27 11:48:45-05:00

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/game/Creature.cpp

    r102 r123  
    9595} 
    9696 
     97uint32 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 
     110uint32 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 
    97119Creature::Creature() : 
    98120Unit(), i_AI(NULL), 
     
    188210    m_creatureInfo = cinfo;                                 // map mode related always 
    189211 
    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); 
    193216        return false; 
    194217    } 
     
    11171140    if(cinfo) 
    11181141    { 
    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; 
    11331144    } 
    11341145