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;
}
void NodeMetadataList::deSerialize(std::istream &is, IGameDef *gamedef)
{
- m_data.clear();
+ clear();
u8 version = readU8(is);
-
+
if(version == 0){
// Nothing
return;
{
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;
if(m_data.find(p) != m_data.end())
{