X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=src%2Fstaticobject.h;h=6fb486193c9790fc2727c7283d959e808fe0107b;hb=5b42b5a8c26811bd7cb152cbb5ffeee77abb8d66;hp=d522e2ad7cc72d032eeee2c77010266ddd0fd59a;hpb=037b2591971d752e67fa7d47095b996b3f56da5a;p=dragonfireclient.git diff --git a/src/staticobject.h b/src/staticobject.h index d522e2ad7..6fb486193 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,28 @@ 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" + +class ServerActiveObject; 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_): - type(type_), - pos(pos_), - data(data_) - { - } + StaticObject() = default; + StaticObject(const ServerActiveObject *s_obj, const v3f &pos_); - 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 -