diff options
author | Daniel O'Brien <marmot.daniel@gmail.com> | 2013-11-15 16:23:50 +0100 |
---|---|---|
committer | Daniel O'Brien <marmot.daniel@gmail.com> | 2013-11-15 16:23:50 +0100 |
commit | 04dff4882a3d75f3a0d432fb3377cc3f59fdf251 (patch) | |
tree | fca7853f6f6e69cc3e1b75b958ced35ba82712fa /source/Entities | |
parent | Merge remote-tracking branch 'upstream/master' into playerxp (diff) | |
download | cuberite-04dff4882a3d75f3a0d432fb3377cc3f59fdf251.tar cuberite-04dff4882a3d75f3a0d432fb3377cc3f59fdf251.tar.gz cuberite-04dff4882a3d75f3a0d432fb3377cc3f59fdf251.tar.bz2 cuberite-04dff4882a3d75f3a0d432fb3377cc3f59fdf251.tar.lz cuberite-04dff4882a3d75f3a0d432fb3377cc3f59fdf251.tar.xz cuberite-04dff4882a3d75f3a0d432fb3377cc3f59fdf251.tar.zst cuberite-04dff4882a3d75f3a0d432fb3377cc3f59fdf251.zip |
Diffstat (limited to 'source/Entities')
-rw-r--r-- | source/Entities/Player.cpp | 19 | ||||
-rw-r--r-- | source/Entities/Player.h | 2 |
2 files changed, 18 insertions, 3 deletions
diff --git a/source/Entities/Player.cpp b/source/Entities/Player.cpp index 00c2ea76c..651a0b2a6 100644 --- a/source/Entities/Player.cpp +++ b/source/Entities/Player.cpp @@ -339,7 +339,7 @@ bool cPlayer::SetExperience(short int a_XpTotal) m_XpTotal = a_XpTotal; //send details to client - m_ClientHandle->SendSetExperience(); + SendExperience(); return true; } @@ -363,7 +363,7 @@ short cPlayer::AddExperience(short a_Xp_delta) m_XpTotal += a_Xp_delta; //send details to client - m_ClientHandle->SendSetExperience(); + SendExperience(); return m_XpTotal; } @@ -615,6 +615,18 @@ void cPlayer::SendHealth(void) +void cPlayer::SendExperience(void) +{ + if (m_ClientHandle != NULL) + { + m_ClientHandle->SendExperience(); + } +} + + + + + void cPlayer::ClearInventoryPaintSlots(void) { // Clear the list of slots that are being inventory-painted. Used by cWindow only @@ -1419,12 +1431,13 @@ bool cPlayer::LoadFromDisk() SetRoll ((float)JSON_PlayerRotation[(unsigned int)2].asDouble()); } - m_Health = root.get("health", 0).asInt(); + m_Health = root.get("health", 0).asInt(); m_AirLevel = root.get("air", MAX_AIR_LEVEL).asInt(); m_FoodLevel = root.get("food", MAX_FOOD_LEVEL).asInt(); m_FoodSaturationLevel = root.get("foodSaturation", MAX_FOOD_LEVEL).asDouble(); m_FoodTickTimer = root.get("foodTickTimer", 0).asInt(); m_FoodExhaustionLevel = root.get("foodExhaustion", 0).asDouble(); + m_XpTotal = root.get("experience", 0).asInt(); //SetExperience(root.get("experience", 0).asInt()); diff --git a/source/Entities/Player.h b/source/Entities/Player.h index 1e43dd954..aeec9f361 100644 --- a/source/Entities/Player.h +++ b/source/Entities/Player.h @@ -269,6 +269,8 @@ public: void UseEquippedItem(void); void SendHealth(void); + + void SendExperience(void); // In UI windows, the item that the player is dragging: bool IsDraggingItem(void) const { return !m_DraggingItem.IsEmpty(); } |