3 Copyright (C) 2010-2011 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 #ifndef STATICOBJECT_HEADER
21 #define STATICOBJECT_HEADER
23 #include "irrlichttypes_bloated.h"
39 StaticObject(u8 type_, v3f pos_, const std::string &data_):
46 void serialize(std::ostream &os);
47 void deSerialize(std::istream &is, u8 version);
50 class StaticObjectList
54 Inserts an object to the container.
55 Id must be unique or 0.
57 void insert(u16 id, StaticObject obj)
61 m_stored.push_back(obj);
65 if(m_active.find(id) != NULL)
67 dstream<<"ERROR: StaticObjectList::insert(): "
68 <<"id already exists"<<std::endl;
72 m_active.insert(id, obj);
79 if(m_active.find(id) == NULL)
81 dstream<<"WARNING: StaticObjectList::remove(): id="<<id
82 <<" not found"<<std::endl;
88 void serialize(std::ostream &os);
89 void deSerialize(std::istream &is);
92 NOTE: When an object is transformed to active, it is removed
93 from m_stored and inserted to m_active.
94 The caller directly manipulates these containers.
96 core::list<StaticObject> m_stored;
97 core::map<u16, StaticObject> m_active;