summaryrefslogtreecommitdiffstats
path: root/src/Entities/Player.h
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2015-01-24 20:17:00 +0100
committerMattes D <github@xoft.cz>2015-01-27 14:53:31 +0100
commit7dfeb67f016135c6da8373b96c32d447e8bf027e (patch)
treeb81a3fbc2399a2bbe2aac31f396234e58d67d49c /src/Entities/Player.h
parentcNetwork: Fixed IP address reading for incoming connections. (diff)
downloadcuberite-7dfeb67f016135c6da8373b96c32d447e8bf027e.tar
cuberite-7dfeb67f016135c6da8373b96c32d447e8bf027e.tar.gz
cuberite-7dfeb67f016135c6da8373b96c32d447e8bf027e.tar.bz2
cuberite-7dfeb67f016135c6da8373b96c32d447e8bf027e.tar.lz
cuberite-7dfeb67f016135c6da8373b96c32d447e8bf027e.tar.xz
cuberite-7dfeb67f016135c6da8373b96c32d447e8bf027e.tar.zst
cuberite-7dfeb67f016135c6da8373b96c32d447e8bf027e.zip
Diffstat (limited to 'src/Entities/Player.h')
-rw-r--r--src/Entities/Player.h18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/Entities/Player.h b/src/Entities/Player.h
index d3ed46db6..fa9ac7cad 100644
--- a/src/Entities/Player.h
+++ b/src/Entities/Player.h
@@ -40,7 +40,7 @@ public:
CLASS_PROTODEF(cPlayer)
- cPlayer(cClientHandle * a_Client, const AString & a_PlayerName);
+ cPlayer(cClientHandlePtr a_Client, const AString & a_PlayerName);
virtual ~cPlayer();
@@ -222,7 +222,15 @@ public:
/** Closes the current window if it matches the specified ID, resets current window to m_InventoryWindow */
void CloseWindowIfID(char a_WindowID, bool a_CanRefuse = true);
- cClientHandle * GetClientHandle(void) const { return m_ClientHandle; }
+ /** Returns the raw client handle associated with the player. */
+ cClientHandle * GetClientHandle(void) const { return m_ClientHandle.get(); }
+
+ // tolua_end
+
+ /** Returns the SharedPtr to client handle associated with the player. */
+ cClientHandlePtr GetClientHandlePtr(void) const { return m_ClientHandle; }
+
+ // tolua_begin
void SendMessage (const AString & a_Message) { m_ClientHandle->SendChat(a_Message, mtCustom); }
void SendMessageInfo (const AString & a_Message) { m_ClientHandle->SendChat(a_Message, mtInformation); }
@@ -467,6 +475,10 @@ public:
virtual bool IsRclking (void) const { return IsEating() || IsChargingBow(); }
virtual void Detach(void);
+
+ /** Called by cClientHandle when the client is being destroyed.
+ The player removes its m_ClientHandle ownership so that the ClientHandle gets deleted. */
+ void RemoveClientHandle(void);
protected:
@@ -537,7 +549,7 @@ protected:
std::chrono::steady_clock::time_point m_LastPlayerListTime;
- cClientHandle * m_ClientHandle;
+ cClientHandlePtr m_ClientHandle;
cSlotNums m_InventoryPaintSlots;