aboutsummaryrefslogtreecommitdiff
path: root/src/script/lua_api/l_util.h
diff options
context:
space:
mode:
authorLars Hofhansl <larsh@apache.org>2016-12-10 10:31:17 -0800
committerparamat <mat.gregory@virginmedia.com>2016-12-24 00:28:39 +0000
commit2f59a0c840e9101c87e2d59fabf34116b3328121 (patch)
tree03bc323e3ce3f718d20454af37306b5409ea6c33 /src/script/lua_api/l_util.h
parent923a8f1983271f65c80cbbde7c46153ce58560b4 (diff)
downloadminetest-2f59a0c840e9101c87e2d59fabf34116b3328121.tar.gz
minetest-2f59a0c840e9101c87e2d59fabf34116b3328121.tar.bz2
minetest-2f59a0c840e9101c87e2d59fabf34116b3328121.zip
Process ABMs in a spherical volume instead of cubic
Increase active_block_range default to a 3 mapblock radius.
Diffstat (limited to 'src/script/lua_api/l_util.h')
0 files changed, 0 insertions, 0 deletions
d a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #ifndef STATICOBJECT_HEADER #define STATICOBJECT_HEADER #include "irrlichttypes_bloated.h" #include <string> #include <sstream> #include <vector> #include <map> #include "debug.h" struct StaticObject { u8 type; v3f pos; std::string data; StaticObject(): type(0), pos(0,0,0) { } StaticObject(u8 type_, v3f pos_, const std::string &data_): type(type_), pos(pos_), data(data_) { } void serialize(std::ostream &os); void deSerialize(std::istream &is, u8 version); }; class StaticObjectList { public: /* Inserts an object to the container. Id must be unique (active) or 0 (stored). */ void insert(u16 id, StaticObject obj) { if(id == 0) { m_stored.push_back(obj); } else { if(m_active.find(id) != m_active.end()) { dstream<<"ERROR: StaticObjectList::insert(): " <<"id already exists"<<std::endl; FATAL_ERROR("StaticObjectList::insert()"); } m_active[id] = obj; } } void remove(u16 id) { assert(id != 0); // Pre-condition if(m_active.find(id) == m_active.end()) { warningstream<<"StaticObjectList::remove(): id="<<id <<" not found"<<std::endl; return; } m_active.erase(id); } void serialize(std::ostream &os); void deSerialize(std::istream &is); /* NOTE: When an object is transformed to active, it is removed from m_stored and inserted to m_active. The caller directly manipulates these containers. */ std::vector<StaticObject> m_stored; std::map<u16, StaticObject> m_active; private: