diff options
author | Elias Fleckenstein <54945686+EliasFleckenstein03@users.noreply.github.com> | 2020-11-04 16:57:47 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-04 16:57:47 +0100 |
commit | 3e16c3a78fff61c20e63ba730d15e94e3bb877b4 (patch) | |
tree | c070350db219f2c4241d22bc31949685c7b42fe9 /src/staticobject.cpp | |
parent | 5d9ae5a91c544fc7fbd475decf47cef7e09ef8fc (diff) | |
parent | 6ccb5835ff55d85156be91473c598eca9d6cb9a6 (diff) | |
download | dragonfireclient-3e16c3a78fff61c20e63ba730d15e94e3bb877b4.tar.xz |
Merge branch 'master' into master
Diffstat (limited to 'src/staticobject.cpp')
-rw-r--r-- | src/staticobject.cpp | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/src/staticobject.cpp b/src/staticobject.cpp index 79762e003..5ccb7baf5 100644 --- a/src/staticobject.cpp +++ b/src/staticobject.cpp @@ -21,8 +21,9 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "util/serialize.h" #include "server/serveractiveobject.h" -StaticObject::StaticObject(const ServerActiveObject *s_obj, const v3f &pos_) : - type(s_obj->getType()), pos(pos_) +StaticObject::StaticObject(const ServerActiveObject *s_obj, const v3f &pos_): + type(s_obj->getType()), + pos(pos_) { s_obj->getStaticData(&data); } @@ -34,7 +35,7 @@ void StaticObject::serialize(std::ostream &os) // pos writeV3F1000(os, pos); // data - os << serializeString(data); + os<<serializeString(data); } void StaticObject::deSerialize(std::istream &is, u8 version) { @@ -55,13 +56,12 @@ void StaticObjectList::serialize(std::ostream &os) // count size_t count = m_stored.size() + m_active.size(); // Make sure it fits into u16, else it would get truncated and cause e.g. - // issue #2610 (Invalid block data in database: unsupported NameIdMapping - // version). + // issue #2610 (Invalid block data in database: unsupported NameIdMapping version). if (count > U16_MAX) { errorstream << "StaticObjectList::serialize(): " - << "too many objects (" << count << ") in list, " - << "not writing them to disk." << std::endl; - writeU16(os, 0); // count = 0 + << "too many objects (" << count << ") in list, " + << "not writing them to disk." << std::endl; + writeU16(os, 0); // count = 0 return; } writeU16(os, count); @@ -79,10 +79,10 @@ void StaticObjectList::deSerialize(std::istream &is) { if (m_active.size()) { errorstream << "StaticObjectList::deSerialize(): " - << "deserializing objects while " << m_active.size() - << " active objects already exist (not cleared). " - << m_stored.size() << " stored objects _were_ cleared" - << std::endl; + << "deserializing objects while " << m_active.size() + << " active objects already exist (not cleared). " + << m_stored.size() << " stored objects _were_ cleared" + << std::endl; } m_stored.clear(); @@ -90,9 +90,10 @@ void StaticObjectList::deSerialize(std::istream &is) u8 version = readU8(is); // count u16 count = readU16(is); - for (u16 i = 0; i < count; i++) { + for(u16 i = 0; i < count; i++) { StaticObject s_obj; s_obj.deSerialize(is, version); m_stored.push_back(s_obj); } } + |