1
0

Minecart entity now supports IsA() self-identification

git-svn-id: http://mc-server.googlecode.com/svn/trunk@1225 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
madmaxoft@gmail.com 2013-02-27 10:02:06 +00:00
parent 71cd0199fd
commit 5eff323db2
2 changed files with 10 additions and 6 deletions

View File

@ -11,7 +11,7 @@
// Place this macro in the header of each cEntity descendant class and you're done :)
// Place this macro in the public section of each cEntity descendant class and you're done :)
#define CLASS_PROTODEF(classname) \
virtual bool IsA(const char * a_ClassName) const override\
{ \
@ -84,9 +84,10 @@ public:
eEntityType GetEntityType(void) const { return m_EntityType; }
bool IsPlayer(void) const { return (m_EntityType == etPlayer); }
bool IsPickup(void) const { return (m_EntityType == etPickup); }
bool IsMob (void) const { return (m_EntityType == etMob); }
bool IsPlayer (void) const { return (m_EntityType == etPlayer); }
bool IsPickup (void) const { return (m_EntityType == etPickup); }
bool IsMob (void) const { return (m_EntityType == etMob); }
bool IsMinecart(void) const { return (m_EntityType == etMinecart); }
/// Returns true if the entity is of the specified class or a subclass (cPawn's IsA("cEntity") returns true)
virtual bool IsA(const char * a_ClassName) const;

View File

@ -21,13 +21,16 @@ class cMinecart :
typedef cEntity super;
public:
CLASS_PROTODEF(cMinecart);
enum ePayload
{
mpNone, // Empty minecart, ridable by player or mobs
mpChest, // Minecart-with-chest, can store a grid of 3*8 items
mpNone, // Empty minecart, ridable by player or mobs
mpChest, // Minecart-with-chest, can store a grid of 3*8 items
mpFurnace, // Minecart-with-furnace, can be powered
// TODO: Other 1.5 features: hopper, tnt, dispenser, spawner
} ;
cMinecart(ePayload a_Payload, double a_X, double a_Y, double a_Z);
// cEntity overrides: