*Add a new modelid function..

*Attempt to fix some Linux compile issues..

--HG--
branch : trunk
This commit is contained in:
maximius
2009-09-24 11:26:27 -07:00
parent 8ccf471bcb
commit c3e795e7dd
4 changed files with 31 additions and 5 deletions
+18 -3
View File
@@ -88,9 +88,24 @@ VendorItem const* VendorItemData::FindItem(uint32 item_id) const
return NULL;
}
uint32 CreatureInfo::GetRandomValidModelIdIncludingNativeId(uint32 native_id) const
{
uint8 c = 0;
uint32 modelIDs[5];
if (Modelid1) modelIDs[c++] = Modelid1;
if (Modelid2) modelIDs[c++] = Modelid2;
if (Modelid3) modelIDs[c++] = Modelid3;
if (Modelid4) modelIDs[c++] = Modelid4;
if (native_id != Modelid1 && native_id != Modelid2
&& native_id != Modelid3 && native_id != Modelid4) modelIDs[c++] = native_id;
return ((c>0) ? modelIDs[urand(0,c-1)] : 0);
}
uint32 CreatureInfo::GetRandomValidModelId() const
{
uint32 c = 0;
uint8 c = 0;
uint32 modelIDs[4];
if (Modelid1) modelIDs[c++] = Modelid1;
@@ -724,7 +739,7 @@ bool Creature::Create(uint32 guidlow, Map *map, uint32 phaseMask, uint32 Entry,
}
LoadCreaturesAddon();
}
SetDisplayId(GetCreatureInfo()->GetRandomValidModelId());
SetDisplayId(GetCreatureInfo()->GetRandomValidModelIdIncludingNativeId(GetNativeDisplayId()));
return bResult;
}
@@ -1844,7 +1859,7 @@ void Creature::Respawn(bool force)
else
setDeathState( JUST_ALIVED );
SetDisplayId(cinfo->GetRandomValidModelId());
SetDisplayId(cinfo->GetRandomValidModelIdIncludingNativeId(GetNativeDisplayId()));
//Call AI respawn virtual function
AI()->JustRespawned();
+1
View File
@@ -236,6 +236,7 @@ struct CreatureInfo
uint32 MechanicImmuneMask;
uint32 flags_extra;
uint32 ScriptID;
uint32 GetRandomValidModelIdIncludingNativeId(uint32 native_id) const;
uint32 GetRandomValidModelId() const;
uint32 GetFirstValidModelId() const;
+2
View File
@@ -39,12 +39,14 @@ class Item;
class Object;
class Player;
class Unit;
class GameObject;
class WorldPacket;
class WorldSocket;
class WorldSession;
class QueryResult;
class LoginQueryHolder;
class CharacterHandler;
class AreaTableEntry;
enum AccountDataType
{