X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=src%2Fstaticobject.h;h=43f542632298a981ec2c3989f0c69009511f6508;hb=5a3b8e34b36a1f9b1f38f91483fc25d23b142f21;hp=d522e2ad7cc72d032eeee2c77010266ddd0fd59a;hpb=037b2591971d752e67fa7d47095b996b3f56da5a;p=oweals%2Fminetest.git diff --git a/src/staticobject.h b/src/staticobject.h index d522e2ad7..43f542632 100644 --- a/src/staticobject.h +++ b/src/staticobject.h @@ -1,6 +1,6 @@ /* -Minetest-c55 -Copyright (C) 2010-2011 celeron55, Perttu Ahola +Minetest +Copyright (C) 2010-2013 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by @@ -17,59 +17,31 @@ 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 +#pragma once -#include "common_irrlicht.h" +#include "irrlichttypes_bloated.h" #include #include -#include "utility.h" +#include +#include +#include "debug.h" struct StaticObject { - u8 type; + u8 type = 0; v3f pos; std::string data; - StaticObject(): - type(0), - pos(0,0,0) - { - } - StaticObject(u8 type_, v3f pos_, const std::string &data_): + StaticObject() = default; + StaticObject(u8 type_, const v3f &pos_, const std::string &data_): type(type_), pos(pos_), data(data_) { } - void serialize(std::ostream &os) - { - char buf[12]; - // type - buf[0] = type; - os.write(buf, 1); - // pos - writeV3S32((u8*)buf, v3s32(pos.X*1000,pos.Y*1000,pos.Z*1000)); - os.write(buf, 12); - // data - os<::Iterator - i = m_stored.begin(); - i != m_stored.end(); i++) - { - StaticObject &s_obj = *i; - s_obj.serialize(os); - } - for(core::map::Iterator - i = m_active.getIterator(); - i.atEnd()==false; i++) - { - StaticObject s_obj = i.getNode()->getValue(); - s_obj.serialize(os); - } - } - void deSerialize(std::istream &is) - { - char buf[12]; - // version - is.read(buf, 1); - u8 version = buf[0]; - // count - is.read(buf, 2); - u16 count = readU16((u8*)buf); - for(u16 i=0; i m_stored; - core::map m_active; + std::vector m_stored; + std::map m_active; private: }; - -#endif -