summaryrefslogtreecommitdiffstats
path: root/src/Entities/Entity.h
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2015-03-24 13:09:41 +0100
committerMattes D <github@xoft.cz>2015-03-24 13:09:41 +0100
commite5a7a730ed4f26eae896c56391bf3d2b5fecb852 (patch)
tree0209c1567f60af60999f3aeeb513a72f9eab2743 /src/Entities/Entity.h
parentMerge pull request #1775 from tommysanterre/terrainheightfix (diff)
parentAdded VarInt64, normalized cPacketizer datatype names. (diff)
downloadcuberite-e5a7a730ed4f26eae896c56391bf3d2b5fecb852.tar
cuberite-e5a7a730ed4f26eae896c56391bf3d2b5fecb852.tar.gz
cuberite-e5a7a730ed4f26eae896c56391bf3d2b5fecb852.tar.bz2
cuberite-e5a7a730ed4f26eae896c56391bf3d2b5fecb852.tar.lz
cuberite-e5a7a730ed4f26eae896c56391bf3d2b5fecb852.tar.xz
cuberite-e5a7a730ed4f26eae896c56391bf3d2b5fecb852.tar.zst
cuberite-e5a7a730ed4f26eae896c56391bf3d2b5fecb852.zip
Diffstat (limited to 'src/Entities/Entity.h')
-rw-r--r--src/Entities/Entity.h13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/Entities/Entity.h b/src/Entities/Entity.h
index 809e974d2..9bb1837f1 100644
--- a/src/Entities/Entity.h
+++ b/src/Entities/Entity.h
@@ -142,6 +142,10 @@ public:
static const int VOID_BOUNDARY = -46; ///< Y position to begin applying void damage
static const int FALL_DAMAGE_HEIGHT = 4; ///< Y difference after which fall damage is applied
+
+ /** Special ID that is considered an "invalid value", signifying no entity. */
+ static const UInt32 INVALID_ID = 0; // Exported to Lua in ManualBindings.cpp, ToLua doesn't parse initialized constants.
+
cEntity(eEntityType a_EntityType, double a_X, double a_Y, double a_Z, double a_Width, double a_Height);
virtual ~cEntity();
@@ -248,7 +252,7 @@ public:
virtual void HandleSpeedFromAttachee(float a_Forward, float a_Sideways);
void SteerVehicle(float a_Forward, float a_Sideways);
- inline int GetUniqueID(void) const { return m_UniqueID; }
+ inline UInt32 GetUniqueID(void) const { return m_UniqueID; }
inline bool IsDestroyed(void) const { return !m_IsInitialized; }
/// Schedules the entity for destroying; if a_ShouldBroadcast is set to true, broadcasts the DestroyEntity packet
@@ -464,12 +468,15 @@ public:
protected:
static cCriticalSection m_CSCount;
- static int m_EntityCount;
+ static UInt32 m_EntityCount;
/** Measured in meter/second (m/s) */
Vector3d m_Speed;
- int m_UniqueID;
+ /** The ID of the entity that is guaranteed to be unique within a single run of the server.
+ Always nonzero (a zero UniqueID (cEntity::INVALID_ID) is used for error reporting).
+ Note that the UniqueID is not persisted through storage. */
+ UInt32 m_UniqueID;
int m_Health;
int m_MaxHealth;