From d3801c0296dd32f430a4074932bfabf27a8ade03 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Sun, 28 Jul 2013 11:30:54 +0200 Subject: Added cPlayer::IsGameModeXXX() and cWorld::IsGameModeXXX() functions. These are the preferred way of determining the gamemode, you should use those instead of doing manual comparisons to the gamemode value. --- source/Player.h | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'source/Player.h') diff --git a/source/Player.h b/source/Player.h index fed222157..69b0c3df1 100644 --- a/source/Player.h +++ b/source/Player.h @@ -73,7 +73,18 @@ public: virtual void TeleportToCoords(double a_PosX, double a_PosY, double a_PosZ) override; - eGameMode GetGameMode(void) const { return m_GameMode; } // tolua_export + /// Returns the current gamemode. Partly OBSOLETE, you should use IsGameModeXXX() functions wherever applicable + eGameMode GetGameMode(void) const { return m_GameMode; } // tolua_export + + /// Returns true if the player is in Creative mode, either explicitly, or by inheriting from current world + bool IsGameModeCreative(void) const; + + /// Returns true if the player is in Survival mode, either explicitly, or by inheriting from current world + bool IsGameModeSurvival(void) const; + + /// Returns true if the player is in Adventure mode, either explicitly, or by inheriting from current world + bool IsGameModeAdventure(void) const; + std::string GetIP() { return m_IP; } // tolua_export float GetLastBlockActionTime() { return m_LastBlockActionTime; } // tolua_export int GetLastBlockActionCnt() { return m_LastBlockActionCnt; } // tolua_export -- cgit v1.2.3