From 578560d2132188279e4b0930212edd915bc90008 Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Mon, 1 Apr 2013 20:56:25 +0000 Subject: Proper fix for FS #347. Also unification of ticking block entities. git-svn-id: http://mc-server.googlecode.com/svn/trunk@1348 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/BlockEntity.h | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'source/BlockEntity.h') diff --git a/source/BlockEntity.h b/source/BlockEntity.h index b7d1fe6c4..d62f8aa5e 100644 --- a/source/BlockEntity.h +++ b/source/BlockEntity.h @@ -43,18 +43,18 @@ protected: {} public: virtual ~cBlockEntity() {}; - virtual void Destroy() {}; + virtual void Destroy(void) {}; // Position, in absolute block coordinates: - int GetPosX() { return m_PosX; } - int GetPosY() { return m_PosY; } - int GetPosZ() { return m_PosZ; } + int GetPosX(void) const { return m_PosX; } + int GetPosY(void) const { return m_PosY; } + int GetPosZ(void) const { return m_PosZ; } - ENUM_BLOCK_ID GetBlockType() { return m_BlockType; } + ENUM_BLOCK_ID GetBlockType(void) const { return m_BlockType; } cWorld * GetWorld(void) const {return m_World; } - virtual void SaveToJson (Json::Value & a_Value ) = 0; + virtual void SaveToJson (Json::Value & a_Value) = 0; virtual void UsedBy( cPlayer * a_Player ) = 0; @@ -62,6 +62,9 @@ public: To send to all eligible clients, use cWorld::BroadcastBlockEntity() */ virtual void SendTo(cClientHandle & a_Client) = 0; + + /// Ticks the entity; returns true if the chunk should be marked as dirty as a result of this ticking. By default does nothing. + virtual bool Tick(float a_Dt) { return false; } protected: int m_PosX; // Position in absolute block coordinates -- cgit v1.2.3