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]) {