From 280946ba836cde9516f9344f47561f3356bdf869 Mon Sep 17 00:00:00 2001 From: PilzAdam Date: Fri, 28 Jun 2013 14:06:34 +0000 Subject: Dont write player files all the time --- src/player.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'src/player.h') diff --git a/src/player.h b/src/player.h index 89e4667c4..60645a60f 100644 --- a/src/player.h +++ b/src/player.h @@ -199,6 +199,23 @@ public: void serialize(std::ostream &os); void deSerialize(std::istream &is, std::string playername); + bool checkModified() + { + if(m_last_hp != hp || m_last_pitch != m_pitch || + m_last_pos != m_position || m_last_yaw != m_yaw || + !(inventory == m_last_inventory)) + { + m_last_hp = hp; + m_last_pitch = m_pitch; + m_last_pos = m_position; + m_last_yaw = m_yaw; + m_last_inventory = inventory; + return true; + } else { + return false; + } + } + bool touching_ground; // This oscillates so that the player jumps a bit above the surface bool in_liquid; @@ -262,6 +279,12 @@ protected: v3f m_speed; v3f m_position; core::aabbox3d m_collisionbox; + + f32 m_last_pitch; + f32 m_last_yaw; + v3f m_last_pos; + u16 m_last_hp; + Inventory m_last_inventory; }; -- cgit v1.2.3