summaryrefslogtreecommitdiffstats
path: root/source/Mobs/Monster.cpp
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2013-10-20 14:15:55 +0200
committermadmaxoft <github@xoft.cz>2013-10-20 14:15:55 +0200
commitd8576a79537029bc40ff9a125e9ada4739ce76bb (patch)
tree69ae7d97c465339cd7405ce34a3895c31c0efc81 /source/Mobs/Monster.cpp
parentFixed memory leaks in cMobCensus, moved GetSpawnRate() to cMonster. (diff)
downloadcuberite-d8576a79537029bc40ff9a125e9ada4739ce76bb.tar
cuberite-d8576a79537029bc40ff9a125e9ada4739ce76bb.tar.gz
cuberite-d8576a79537029bc40ff9a125e9ada4739ce76bb.tar.bz2
cuberite-d8576a79537029bc40ff9a125e9ada4739ce76bb.tar.lz
cuberite-d8576a79537029bc40ff9a125e9ada4739ce76bb.tar.xz
cuberite-d8576a79537029bc40ff9a125e9ada4739ce76bb.tar.zst
cuberite-d8576a79537029bc40ff9a125e9ada4739ce76bb.zip
Diffstat (limited to '')
-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;
}