From 082573771f469cfaef03d22e4281f207beef36c8 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Thu, 14 Nov 2013 15:37:09 +0100 Subject: Added cSignEntity into API, added cChunkDesc:GetBlockEntity(). This fixes both #228 and #347. --- source/BlockEntities/SignEntity.h | 43 ++++++++++++++++++++++++++++++++------- 1 file changed, 36 insertions(+), 7 deletions(-) (limited to 'source/BlockEntities/SignEntity.h') diff --git a/source/BlockEntities/SignEntity.h b/source/BlockEntities/SignEntity.h index b4e7a141f..50706bdfe 100644 --- a/source/BlockEntities/SignEntity.h +++ b/source/BlockEntities/SignEntity.h @@ -1,4 +1,12 @@ +// SignEntity.h + +// Declares the cSignEntity class representing a single sign in the world + + + + + #pragma once #include "BlockEntity.h" @@ -13,28 +21,49 @@ namespace Json } + + + +// tolua_begin + class cSignEntity : public cBlockEntity { + typedef cBlockEntity super; + public: + + /// Creates a new empty sign entity at the specified block coords and block type (wall or standing) + /// Used mainly by plugins while generating chunks + cSignEntity(BLOCKTYPE a_BlockType, int a_BlockX, int a_BlockY, int a_BlockZ); + + // tolua_end + cSignEntity(BLOCKTYPE a_BlockType, int a_X, int a_Y, int a_Z, cWorld * a_World); - virtual ~cSignEntity(); bool LoadFromJson( const Json::Value& a_Value ); virtual void SaveToJson(Json::Value& a_Value ) override; - void SetLines( const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4 ); - void SetLine( int a_Index, const AString & a_Line ); - - AString GetLine( int a_Index ) const; + // tolua_begin + + /// Sets all the sign's lines + void SetLines(const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4); + + /// Sets individual line (zero-based index) + void SetLine(int a_Index, const AString & a_Line); - virtual void UsedBy( cPlayer * a_Player ) override; + /// Retrieves individual line (zero-based index) + AString GetLine(int a_Index) const; + + // tolua_end + + virtual void UsedBy(cPlayer * a_Player) override; virtual void SendTo(cClientHandle & a_Client) override; private: AString m_Line[4]; -}; +} ; // tolua_export -- cgit v1.2.3 From ebb2ccaa267116106002f358e18c5af58e13ec34 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Fri, 15 Nov 2013 09:36:43 +0100 Subject: Removed BlockEntities' constructors from the API. Plugins shouldn't construct block entities, rather, they will query them either from the cWorld (while playing), or from cChunkDesc (while generating). --- source/BlockEntities/SignEntity.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'source/BlockEntities/SignEntity.h') diff --git a/source/BlockEntities/SignEntity.h b/source/BlockEntities/SignEntity.h index 50706bdfe..d998ff1e8 100644 --- a/source/BlockEntities/SignEntity.h +++ b/source/BlockEntities/SignEntity.h @@ -33,12 +33,9 @@ class cSignEntity : public: - /// Creates a new empty sign entity at the specified block coords and block type (wall or standing) - /// Used mainly by plugins while generating chunks - cSignEntity(BLOCKTYPE a_BlockType, int a_BlockX, int a_BlockY, int a_BlockZ); - // tolua_end + /// Creates a new empty sign entity at the specified block coords and block type (wall or standing). a_World may be NULL cSignEntity(BLOCKTYPE a_BlockType, int a_X, int a_Y, int a_Z, cWorld * a_World); bool LoadFromJson( const Json::Value& a_Value ); -- cgit v1.2.3 From 675b4aa878f16291ce33fced48a2bc7425f635ae Mon Sep 17 00:00:00 2001 From: Alexander Harkness Date: Sun, 24 Nov 2013 14:19:41 +0000 Subject: Moved source to src --- source/BlockEntities/SignEntity.h | 67 --------------------------------------- 1 file changed, 67 deletions(-) delete mode 100644 source/BlockEntities/SignEntity.h (limited to 'source/BlockEntities/SignEntity.h') diff --git a/source/BlockEntities/SignEntity.h b/source/BlockEntities/SignEntity.h deleted file mode 100644 index d998ff1e8..000000000 --- a/source/BlockEntities/SignEntity.h +++ /dev/null @@ -1,67 +0,0 @@ - -// SignEntity.h - -// Declares the cSignEntity class representing a single sign in the world - - - - - -#pragma once - -#include "BlockEntity.h" - - - - - -namespace Json -{ - class Value; -} - - - - - -// tolua_begin - -class cSignEntity : - public cBlockEntity -{ - typedef cBlockEntity super; - -public: - - // tolua_end - - /// Creates a new empty sign entity at the specified block coords and block type (wall or standing). a_World may be NULL - cSignEntity(BLOCKTYPE a_BlockType, int a_X, int a_Y, int a_Z, cWorld * a_World); - - bool LoadFromJson( const Json::Value& a_Value ); - virtual void SaveToJson(Json::Value& a_Value ) override; - - // tolua_begin - - /// Sets all the sign's lines - void SetLines(const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4); - - /// Sets individual line (zero-based index) - void SetLine(int a_Index, const AString & a_Line); - - /// Retrieves individual line (zero-based index) - AString GetLine(int a_Index) const; - - // tolua_end - - virtual void UsedBy(cPlayer * a_Player) override; - virtual void SendTo(cClientHandle & a_Client) override; - -private: - - AString m_Line[4]; -} ; // tolua_export - - - - -- cgit v1.2.3