3 Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation; either version 2.1 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public License along
16 with this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 #include "staticobject.h"
21 #include "util/serialize.h"
23 void StaticObject::serialize(std::ostream &os)
28 writeV3F1000(os, pos);
30 os<<serializeString(data);
32 void StaticObject::deSerialize(std::istream &is, u8 version)
37 pos = readV3F1000(is);
39 data = deSerializeString(is);
42 void StaticObjectList::serialize(std::ostream &os)
48 u16 count = m_stored.size() + m_active.size();
50 for(std::vector<StaticObject>::iterator
52 i != m_stored.end(); ++i) {
53 StaticObject &s_obj = *i;
56 for(std::map<u16, StaticObject>::iterator
58 i != m_active.end(); ++i)
60 StaticObject s_obj = i->second;
64 void StaticObjectList::deSerialize(std::istream &is)
67 u8 version = readU8(is);
69 u16 count = readU16(is);
70 for(u16 i = 0; i < count; i++) {
72 s_obj.deSerialize(is, version);
73 m_stored.push_back(s_obj);