]> git.lizzy.rs Git - dragonfireclient.git/blobdiff - src/nodetimer.cpp
Enforce hiding nametag
[dragonfireclient.git] / src / nodetimer.cpp
index db5fb08b67d54b0f1940f827e1934d35c1600f49..790b460760324f5e5b63abfbecbe7e0ea7d13ca6 100644 (file)
@@ -19,6 +19,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 
 #include "nodetimer.h"
 #include "log.h"
+#include "serialization.h"
 #include "util/serialize.h"
 #include "constants.h" // MAP_BLOCKSIZE
 
@@ -46,7 +47,7 @@ void NodeTimerList::serialize(std::ostream &os, u8 map_format_version) const
 {
        if(map_format_version == 24){
                // Version 0 is a placeholder for "nothing to see here; go away."
-               if(m_data.size() == 0){
+               if(m_data.empty()){
                        writeU8(os, 0); // version
                        return;
                }
@@ -95,12 +96,12 @@ void NodeTimerList::deSerialize(std::istream &is, u8 map_format_version)
        {
                u16 p16 = readU16(is);
 
-               v3s16 p(0,0,0);
-               p.Z += p16 / MAP_BLOCKSIZE / MAP_BLOCKSIZE;
-               p16 -= p.Z * MAP_BLOCKSIZE * MAP_BLOCKSIZE;
-               p.Y += p16 / MAP_BLOCKSIZE;
-               p16 -= p.Y * MAP_BLOCKSIZE;
-               p.X += p16;
+               v3s16 p;
+               p.Z = p16 / MAP_BLOCKSIZE / MAP_BLOCKSIZE;
+               p16 &= MAP_BLOCKSIZE * MAP_BLOCKSIZE - 1;
+               p.Y = p16 / MAP_BLOCKSIZE;
+               p16 &= MAP_BLOCKSIZE - 1;
+               p.X = p16;
 
                NodeTimer t;
                t.deSerialize(is);