summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2014-10-05 22:09:19 +0200
committermadmaxoft <github@xoft.cz>2014-10-05 22:09:19 +0200
commit77c5b410e653433a17c7cf25b115dae4c25bdbd2 (patch)
tree9c83562622c5f554355ddd2ca54605aa04379627
parentFixed typo. (diff)
downloadcuberite-77c5b410e653433a17c7cf25b115dae4c25bdbd2.tar
cuberite-77c5b410e653433a17c7cf25b115dae4c25bdbd2.tar.gz
cuberite-77c5b410e653433a17c7cf25b115dae4c25bdbd2.tar.bz2
cuberite-77c5b410e653433a17c7cf25b115dae4c25bdbd2.tar.lz
cuberite-77c5b410e653433a17c7cf25b115dae4c25bdbd2.tar.xz
cuberite-77c5b410e653433a17c7cf25b115dae4c25bdbd2.tar.zst
cuberite-77c5b410e653433a17c7cf25b115dae4c25bdbd2.zip
-rw-r--r--src/Bindings/AllToLua.pkg1
-rw-r--r--src/BlockID.cpp51
-rw-r--r--src/BlockID.h3
-rw-r--r--src/Mobs/CMakeLists.txt1
-rw-r--r--src/Mobs/Monster.cpp10
-rw-r--r--src/Mobs/MonsterTypes.h13
6 files changed, 25 insertions, 54 deletions
diff --git a/src/Bindings/AllToLua.pkg b/src/Bindings/AllToLua.pkg
index 37e6aecd2..73de98e22 100644
--- a/src/Bindings/AllToLua.pkg
+++ b/src/Bindings/AllToLua.pkg
@@ -27,6 +27,7 @@ $cfile "WebPlugin.h"
$cfile "LuaWindow.h"
$cfile "../BlockID.h"
+$cfile "../Mobs/MonsterTypes.h"
$cfile "../BlockInfo.h"
$cfile "../StringUtils.h"
$cfile "../Defines.h"
diff --git a/src/BlockID.cpp b/src/BlockID.cpp
index 9026d81f2..755c721db 100644
--- a/src/BlockID.cpp
+++ b/src/BlockID.cpp
@@ -253,57 +253,6 @@ AString ItemToFullString(const cItem & a_Item)
-int StringToMobType(const AString & a_MobString)
-{
- static struct
- {
- int m_MobType;
- const char * m_String;
- } MobMap [] =
- {
- {mtCreeper, "Creeper"},
- {mtSkeleton, "Skeleton"},
- {mtSpider, "Spider"},
- {mtGiant, "Giant"},
- {mtZombie, "Zombie"},
- {mtSlime, "Slime"},
- {mtGhast, "Ghast"},
- {mtZombiePigman, "ZombiePigman"},
- {mtEnderman, "Enderman"},
- {mtCaveSpider, "CaveSpider"},
- {mtSilverfish, "SilverFish"},
- {mtBlaze, "Blaze"},
- {mtMagmaCube, "MagmaCube"},
- {mtEnderDragon, "EnderDragon"},
- {mtWither, "Wither"},
- {mtBat, "Bat"},
- {mtWitch, "Witch"},
- {mtPig, "Pig"},
- {mtSheep, "Sheep"},
- {mtCow, "Cow"},
- {mtChicken, "Chicken"},
- {mtSquid, "Squid"},
- {mtWolf, "Wolf"},
- {mtMooshroom, "Mooshroom"},
- {mtSnowGolem, "SnowGolem"},
- {mtOcelot, "Ocelot"},
- {mtIronGolem, "IronGolem"},
- {mtVillager, "Villager"},
- };
- for (size_t i = 0; i < ARRAYCOUNT(MobMap); i++)
- {
- if (NoCaseCompare(MobMap[i].m_String, a_MobString) == 0)
- {
- return MobMap[i].m_MobType;
- }
- } // for i - MobMap[]
- return -1;
-}
-
-
-
-
-
eDimension StringToDimension(const AString & a_DimensionString)
{
// First try decoding as a number
diff --git a/src/BlockID.h b/src/BlockID.h
index 69b5e2fe0..e36843422 100644
--- a/src/BlockID.h
+++ b/src/BlockID.h
@@ -1005,9 +1005,6 @@ extern AString ItemTypeToString(short a_ItemType);
/// Translates a full item into a fully-specified string (including meta and count). If the ItemType is not recognized, the ItemType number is output into the string.
extern AString ItemToFullString(const cItem & a_Item);
-/// Translates a mob string ("ocelot") to mobtype (E_ENTITY_TYPE_OCELOT)
-extern int StringToMobType(const AString & a_MobString);
-
/// Translates a dimension string to dimension enum. Takes either a number or a dimension alias (built-in). Returns dimOverworld on failure
extern eDimension StringToDimension(const AString & a_DimensionString);
diff --git a/src/Mobs/CMakeLists.txt b/src/Mobs/CMakeLists.txt
index 2c092c15f..bbbb9287a 100644
--- a/src/Mobs/CMakeLists.txt
+++ b/src/Mobs/CMakeLists.txt
@@ -54,6 +54,7 @@ SET (HDRS
IronGolem.h
MagmaCube.h
Monster.h
+ MonsterTypes.h
Mooshroom.h
Ocelot.h
PassiveAggressiveMonster.h
diff --git a/src/Mobs/Monster.cpp b/src/Mobs/Monster.cpp
index 12ca6bbbe..cc48dba5e 100644
--- a/src/Mobs/Monster.cpp
+++ b/src/Mobs/Monster.cpp
@@ -62,6 +62,16 @@ static const struct
+eMonsterType StringToMobType(const AString & a_MobString)
+{
+ LOGWARNING("%s: Function is obsolete, use cMonster::StringToMobType() instead");
+ return cMonster::StringToMobType(a_MobString);
+}
+
+
+
+
+
////////////////////////////////////////////////////////////////////////////////
// cMonster:
diff --git a/src/Mobs/MonsterTypes.h b/src/Mobs/MonsterTypes.h
index 7a73e99f4..852eb3446 100644
--- a/src/Mobs/MonsterTypes.h
+++ b/src/Mobs/MonsterTypes.h
@@ -37,5 +37,18 @@ enum eMonsterType
mtZombie = E_META_SPAWN_EGG_ZOMBIE,
mtZombiePigman = E_META_SPAWN_EGG_ZOMBIE_PIGMAN,
} ;
+
+
+
+
+
+/** Translates a mob string ("ocelot") to mobtype (mtOcelot).
+OBSOLETE, use cMonster::StringToMobType() instead.
+Implemented in Monster.cpp. */
+extern eMonsterType StringToMobType(const AString & a_MobString);
+
// tolua_end
+
+
+