1
0

Fixed eMonsterType Lua API mismatch.

This commit is contained in:
madmaxoft 2014-10-05 22:09:19 +02:00
parent 8c058b0fbb
commit 77c5b410e6
6 changed files with 25 additions and 54 deletions

View File

@ -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"

View File

@ -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

View File

@ -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);

View File

@ -54,6 +54,7 @@ SET (HDRS
IronGolem.h
MagmaCube.h
Monster.h
MonsterTypes.h
Mooshroom.h
Ocelot.h
PassiveAggressiveMonster.h

View File

@ -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:

View File

@ -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