summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2014-06-04 19:59:56 +0200
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2014-06-04 19:59:56 +0200
commit74cd4f552152f73d0d46cf726bcef472841e2da5 (patch)
tree9f5f4e9a856ede137d1668497a2612bad1433150
parentRemoved use of auto (diff)
downloadcuberite-74cd4f552152f73d0d46cf726bcef472841e2da5.tar
cuberite-74cd4f552152f73d0d46cf726bcef472841e2da5.tar.gz
cuberite-74cd4f552152f73d0d46cf726bcef472841e2da5.tar.bz2
cuberite-74cd4f552152f73d0d46cf726bcef472841e2da5.tar.lz
cuberite-74cd4f552152f73d0d46cf726bcef472841e2da5.tar.xz
cuberite-74cd4f552152f73d0d46cf726bcef472841e2da5.tar.zst
cuberite-74cd4f552152f73d0d46cf726bcef472841e2da5.zip
Diffstat (limited to '')
-rw-r--r--src/Entities/Player.cpp2
-rw-r--r--src/Entities/Player.h12
-rw-r--r--src/UI/Window.cpp2
3 files changed, 10 insertions, 6 deletions
diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp
index 02a55566c..8e4c89f68 100644
--- a/src/Entities/Player.cpp
+++ b/src/Entities/Player.cpp
@@ -1659,7 +1659,7 @@ void cPlayer::LoadPermissionsFromDisk()
-bool cPlayer::LoadFromDisk(cWorld * a_World)
+bool cPlayer::LoadFromDisk(cWorld *& a_World)
{
a_World = cRoot::Get()->GetWorld(GetLoadedWorldName());
if (a_World == NULL)
diff --git a/src/Entities/Player.h b/src/Entities/Player.h
index 5c0b61064..39031fbfb 100644
--- a/src/Entities/Player.h
+++ b/src/Entities/Player.h
@@ -127,7 +127,7 @@ public:
inline const cItem & GetEquippedItem(void) const { return GetInventory().GetEquippedItem(); } // tolua_export
- /** Returns whether the player is climbing (ladders, vines e.t.c). */
+ /** Returns whether the player is climbing (ladders, vines etc.) */
bool IsClimbing(void) const;
virtual void TeleportToCoords(double a_PosX, double a_PosY, double a_PosZ) override;
@@ -330,8 +330,13 @@ public:
virtual bool MoveToWorld(const AString & a_WorldName, cWorld * a_World = NULL) override; // tolua_export
+ /** Saves all player data, such as inventory, to JSON */
bool SaveToDisk(void);
- bool LoadFromDisk(cWorld * a_World);
+
+ /** Loads player data from JSON to the object
+ Takes a (NULL) cWorld pointer which it will assign a value to based on either the loaded world or default world
+ */
+ bool LoadFromDisk(cWorld *& a_World);
void LoadPermissionsFromDisk(void); // tolua_export
const AString & GetLoadedWorldName() { return m_LoadedWorldName; }
@@ -342,8 +347,7 @@ public:
void SendExperience(void);
- // In UI windows, the item that the player is dragging:
- bool IsDraggingItem(void) const { return !m_DraggingItem.IsEmpty(); }
+ /** In UI windows, the item that the player is dragging */
cItem & GetDraggingItem(void) {return m_DraggingItem; }
// In UI windows, when inventory-painting:
diff --git a/src/UI/Window.cpp b/src/UI/Window.cpp
index 46885390b..c0e2cef64 100644
--- a/src/UI/Window.cpp
+++ b/src/UI/Window.cpp
@@ -283,7 +283,7 @@ void cWindow::OpenedByPlayer(cPlayer & a_Player)
bool cWindow::ClosedByPlayer(cPlayer & a_Player, bool a_CanRefuse)
{
// Checks whether the player is still holding an item
- if (a_Player.IsDraggingItem())
+ if (!a_Player.GetDraggingItem().IsEmpty())
{
LOGD("Player holds item! Dropping it...");
a_Player.TossHeldItem(a_Player.GetDraggingItem().m_ItemCount);