Skip to content

Commit

Permalink
Add two extra model fields to creature_template
Browse files Browse the repository at this point in the history
(based on cmangos/mangos-classic@cd32eab)

Signed-off-by: stfx <stfx@hotmail.de>

(based on cmangos/mangos-wotlk@c353700)

Signed-off-by: stfx <stfx@hotmail.de>
  • Loading branch information
Tobschinski authored and DomGries committed Sep 2, 2015
1 parent 710fbc1 commit 076fb57
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/game/Creature.cpp
Expand Up @@ -454,8 +454,10 @@ uint32 Creature::ChooseDisplayId(const CreatureInfo* cinfo, const CreatureData*
// if mod2 use mod2 unless mod2 has modelid_alt_model (then both by 50%-chance)
// if mod1 use mod1

// model selected here may be replaced with other_gender using own function
// The follow decision tree needs to be updated if MAX_CREATURE_MODEL is changed.
static_assert(MAX_CREATURE_MODEL == 4, "Need to update model selection code for new or removed model fields");

// model selected here may be replaced with other_gender using own function
if (cinfo->ModelId[3] && cinfo->ModelId[2] && cinfo->ModelId[1] && cinfo->ModelId[0])
{
display_id = cinfo->ModelId[urand(0, 3)];
Expand Down Expand Up @@ -1129,6 +1131,9 @@ void Creature::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask)
CreatureInfo const* cinfo = GetCreatureInfo();
if (cinfo)
{
// The following if-else assumes that there are 4 model fields and needs updating if this is changed.
static_assert(MAX_CREATURE_MODEL == 4, "Need to update custom model check for new/removed model fields.");

if (displayId != cinfo->ModelId[0] && displayId != cinfo->ModelId[1] &&
displayId != cinfo->ModelId[2] && displayId != cinfo->ModelId[3])
{
Expand Down

0 comments on commit 076fb57

Please sign in to comment.