X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=src%2Fstaticobject.cpp;h=2e7d45a47fef74a0877babd2d5a48169c52d37ee;hb=3b50b2766aeb09c9fc0ad0ea07426bb2187df3d7;hp=48fadaf069cfc568ec27b0270c7ae02c4562289a;hpb=6d0ea26c2d62c3774ff384cf1bfc2a3372b49a3b;p=minetest.git diff --git a/src/staticobject.cpp b/src/staticobject.cpp index 48fadaf06..2e7d45a47 100644 --- a/src/staticobject.cpp +++ b/src/staticobject.cpp @@ -22,68 +22,52 @@ with this program; if not, write to the Free Software Foundation, Inc., void StaticObject::serialize(std::ostream &os) { - char buf[12]; // type - buf[0] = type; - os.write(buf, 1); + writeU8(os, type); // pos - writeV3S32((u8*)buf, v3s32(pos.X*1000,pos.Y*1000,pos.Z*1000)); - os.write(buf, 12); + writeV3F1000(os, pos); // data os<::Iterator + writeU16(os, count); + for(std::vector::iterator i = m_stored.begin(); - i != m_stored.end(); i++) - { + i != m_stored.end(); ++i) { StaticObject &s_obj = *i; s_obj.serialize(os); } - for(core::map::Iterator - i = m_active.getIterator(); - i.atEnd()==false; i++) + for(std::map::iterator + i = m_active.begin(); + i != m_active.end(); ++i) { - StaticObject s_obj = i.getNode()->getValue(); + StaticObject s_obj = i->second; s_obj.serialize(os); } } void StaticObjectList::deSerialize(std::istream &is) { - char buf[12]; // version - is.read(buf, 1); - u8 version = buf[0]; + u8 version = readU8(is); // count - is.read(buf, 2); - u16 count = readU16((u8*)buf); - for(u16 i=0; i