summaryrefslogtreecommitdiff
path: root/src/player.h
diff options
context:
space:
mode:
authorPilzAdam <pilzadam@minetest.net>2013-06-28 14:06:34 +0000
committerPilzAdam <pilzadam@minetest.net>2013-06-28 14:15:48 +0000
commit280946ba836cde9516f9344f47561f3356bdf869 (patch)
treefb238ce650df6cf6df0545b90f4ebe2859fcbe41 /src/player.h
parent9e100bc42b5275299020ea8619e64f2e4aa76192 (diff)
downloadminetest-280946ba836cde9516f9344f47561f3356bdf869.tar.gz
minetest-280946ba836cde9516f9344f47561f3356bdf869.tar.bz2
minetest-280946ba836cde9516f9344f47561f3356bdf869.zip
Dont write player files all the time
Diffstat (limited to 'src/player.h')
-rw-r--r--src/player.h23
1 files changed, 23 insertions, 0 deletions
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<f32> m_collisionbox;
+
+ f32 m_last_pitch;
+ f32 m_last_yaw;
+ v3f m_last_pos;
+ u16 m_last_hp;
+ Inventory m_last_inventory;
};