summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
Diffstat (limited to 'source')
-rw-r--r--source/Mobs/Monster.cpp65
1 files changed, 27 insertions, 38 deletions
diff --git a/source/Mobs/Monster.cpp b/source/Mobs/Monster.cpp
index c5b116db4..599aa9cfc 100644
--- a/source/Mobs/Monster.cpp
+++ b/source/Mobs/Monster.cpp
@@ -570,45 +570,34 @@ cMonster::eType cMonster::StringToMobType(const AString & a_Name)
cMonster::eFamily cMonster::FamilyFromType(eType a_Type)
{
- static const struct
- {
- eType m_Type;
- eFamily m_Family;
- } TypeMap[] =
- {
- {mtBat, mfAmbient},
- {mtBlaze, mfHostile},
- {mtCaveSpider, mfHostile},
- {mtChicken, mfPassive},
- {mtCow, mfPassive},
- {mtCreeper, mfHostile},
- {mtEnderman, mfHostile},
- {mtGhast, mfHostile},
- {mtHorse, mfPassive},
- {mtMagmaCube, mfHostile},
- {mtMooshroom, mfHostile},
- {mtOcelot, mfHostile},
- {mtPig, mfPassive},
- {mtSheep, mfPassive},
- {mtSilverfish, mfHostile},
- {mtSkeleton, mfHostile},
- {mtSlime, mfHostile},
- {mtSpider, mfHostile},
- {mtSquid, mfWater},
- {mtVillager, mfPassive},
- {mtWitch, mfHostile},
- {mtWolf, mfHostile},
- {mtZombie, mfHostile},
- {mtZombiePigman, mfHostile},
+ switch (a_Type)
+ {
+ case mtBat: return mfAmbient;
+ case mtBlaze: return mfHostile;
+ case mtCaveSpider: return mfHostile;
+ case mtChicken: return mfPassive;
+ case mtCow: return mfPassive;
+ case mtCreeper: return mfHostile;
+ case mtEnderman: return mfHostile;
+ case mtGhast: return mfHostile;
+ case mtHorse: return mfPassive;
+ case mtMagmaCube: return mfHostile;
+ case mtMooshroom: return mfHostile;
+ case mtOcelot: return mfHostile;
+ case mtPig: return mfPassive;
+ case mtSheep: return mfPassive;
+ case mtSilverfish: return mfHostile;
+ case mtSkeleton: return mfHostile;
+ case mtSlime: return mfHostile;
+ case mtSpider: return mfHostile;
+ case mtSquid: return mfWater;
+ case mtVillager: return mfPassive;
+ case mtWitch: return mfHostile;
+ case mtWolf: return mfHostile;
+ case mtZombie: return mfHostile;
+ case mtZombiePigman: return mfHostile;
} ;
-
- for (int i = 0; i < ARRAYCOUNT(TypeMap); i++)
- {
- if (TypeMap[i].m_Type == a_Type)
- {
- return TypeMap[i].m_Family;
- }
- }
+ ASSERT(!"Unhandled mob type");
return mfMaxplusone;
}