LuaVoxelManip: Add option to allocate blank data
[oweals/minetest.git] / src / player.h
index 174f147289a91f20420fddef557a55f5d9c05a7c..435875233b45250368eae095f84292de4c56a0a2 100644 (file)
@@ -142,19 +142,22 @@ public:
 
        virtual void setPosition(const v3f &position)
        {
-               m_dirty = true;
+               if (position != m_position)
+                       m_dirty = true;
                m_position = position;
        }
 
        void setPitch(f32 pitch)
        {
-               m_dirty = true;
+               if (pitch != m_pitch)
+                       m_dirty = true;
                m_pitch = pitch;
        }
 
        virtual void setYaw(f32 yaw)
        {
-               m_dirty = true;
+               if (yaw != m_yaw)
+                       m_dirty = true;
                m_yaw = yaw;
        }
 
@@ -175,7 +178,8 @@ public:
 
        virtual void setBreath(u16 breath)
        {
-               m_dirty = true;
+               if (breath != m_breath)
+                       m_dirty = true;
                m_breath = breath;
        }
 
@@ -222,9 +226,16 @@ public:
        void serialize(std::ostream &os);
        void deSerialize(std::istream &is, std::string playername);
 
-       bool checkModified()
+       bool checkModified() const
        {
-               return m_dirty;
+               return m_dirty || inventory.checkModified();
+       }
+
+       void setModified(const bool x)
+       {
+               m_dirty = x;
+               if (x == false)
+                       inventory.setModified(x);
        }
 
        bool touching_ground;
@@ -238,8 +249,6 @@ public:
        bool swimming_vertical;
        bool camera_barely_in_ceiling;
        
-       u8 light;
-
        Inventory inventory;
 
        f32 movement_acceleration_default;