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.
22 #include "irrlichttypes_bloated.h"
35 StaticObject() = default;
36 StaticObject(u8 type_, const v3f &pos_, const std::string &data_):
43 void serialize(std::ostream &os);
44 void deSerialize(std::istream &is, u8 version);
47 class StaticObjectList
51 Inserts an object to the container.
52 Id must be unique (active) or 0 (stored).
54 void insert(u16 id, const StaticObject &obj)
58 m_stored.push_back(obj);
62 if(m_active.find(id) != m_active.end())
64 dstream<<"ERROR: StaticObjectList::insert(): "
65 <<"id already exists"<<std::endl;
66 FATAL_ERROR("StaticObjectList::insert()");
74 assert(id != 0); // Pre-condition
75 if(m_active.find(id) == m_active.end())
77 warningstream<<"StaticObjectList::remove(): id="<<id
78 <<" not found"<<std::endl;
84 void serialize(std::ostream &os);
85 void deSerialize(std::istream &is);
88 NOTE: When an object is transformed to active, it is removed
89 from m_stored and inserted to m_active.
90 The caller directly manipulates these containers.
92 std::vector<StaticObject> m_stored;
93 std::map<u16, StaticObject> m_active;