From 076fb570fc7724b150cac14a64534edac0f549a5 Mon Sep 17 00:00:00 2001 From: Tobschinski Date: Wed, 2 Sep 2015 23:37:42 +0200 Subject: [PATCH] Add two extra model fields to creature_template (based on cmangos/mangos-classic@cd32eab) Signed-off-by: stfx (based on cmangos/mangos-wotlk@c353700) Signed-off-by: stfx --- src/game/Creature.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/game/Creature.cpp b/src/game/Creature.cpp index 402a386180..6abc1b84af 100644 --- a/src/game/Creature.cpp +++ b/src/game/Creature.cpp @@ -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)]; @@ -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]) {