[Widelands-cvs] SF.net SVN: widelands: [2563] trunk/src
Status: Beta
Brought to you by:
sirver
From: <ixp...@us...> - 2007-08-31 13:16:05
|
Revision: 2563 http://widelands.svn.sourceforge.net/widelands/?rev=2563&view=rev Author: ixprefect Date: 2007-08-31 06:15:58 -0700 (Fri, 31 Aug 2007) Log Message: ----------- Implement a new Map_Object saving scheme. Map_Objects can now save and reload themselves. So far, only Immovable has been migrated to this new scheme, which is set up in a way that should allow moving other classes mostly step by step (though many interdependent ones might still have to be done in one go). Modified Paths: -------------- trunk/src/immovable.cc trunk/src/immovable.h trunk/src/instances.cc trunk/src/instances.h trunk/src/widelands_map_immovable_data_packet.cc trunk/src/widelands_map_immovabledata_data_packet.cc trunk/src/widelands_map_loader.cc trunk/src/widelands_map_saver.cc Added Paths: ----------- trunk/src/widelands_map_object_packet.cc trunk/src/widelands_map_object_packet.h Modified: trunk/src/immovable.cc =================================================================== --- trunk/src/immovable.cc 2007-08-31 06:28:54 UTC (rev 2562) +++ trunk/src/immovable.cc 2007-08-31 13:15:58 UTC (rev 2563) @@ -22,6 +22,8 @@ #include "editor_game_base.h" #include "error.h" #include "field.h" +#include "fileread.h" +#include "filewrite.h" #include "game.h" #include "helper.h" #include "immovable_program.h" @@ -30,6 +32,7 @@ #include "profile.h" #include "rendertarget.h" #include "sound/sound_handler.h" +#include "tribe.h" #include "wexception.h" #include "worker.h" @@ -642,11 +645,164 @@ /* ============================== -Immovable commands +Load/save support ============================== */ +#define IMMOVABLE_SAVEGAME_VERSION 1 + +void Immovable::Loader::load(FileRead& fr) +{ + BaseImmovable::Loader::load(fr); + + Immovable* imm = dynamic_cast<Immovable*>(get_object()); + + // Position + imm->m_position = fr.Coords32(egbase().map().extent()); + imm->set_position(&egbase(), imm->m_position); + + // Animation + const char* animname = fr.CString(); + try { + imm->m_anim = imm->descr().get_animation(animname); + } + catch (Map_Object_Descr::Animation_Nonexistent&) { + imm->m_anim = imm->descr().main_animation(); + log("Warning: Animation '%s' not found, using animation '%s').\n", + animname, imm->descr().get_animation_name(imm->m_anim).c_str()); + } + imm->m_animstart = fr.Signed32(); + + // Programm + if (fr.Unsigned8()) + imm->m_program = imm->descr().get_program(fr.CString()); + else + imm->m_program = 0; + imm->m_program_ptr = fr.Unsigned32(); + + if (!imm->m_program) { + imm->m_program_ptr = 0; + } else { + if (imm->m_program_ptr >= imm->m_program->get_size()) { + // Try to not fail if the program of some immovable has changed + // significantly. + // Note that in some cases, the immovable may end up broken despite + // the fixup, but there isn't really anything we can do against that. + log("Warning: Immovable '%s', size of program '%s' seems to have changed.\n", + imm->descr().name().c_str(), imm->m_program->get_name().c_str()); + imm->m_program_ptr = 0; + } + } + + imm->m_program_step = fr.Signed32(); +} + +void Immovable::Loader::load_pointers() +{ + BaseImmovable::Loader::load_pointers(); +} + +void Immovable::Loader::load_finish() +{ + BaseImmovable::Loader::load_finish(); + + Immovable* imm = dynamic_cast<Immovable*>(get_object()); + + egbase().inform_players_about_immovable + (Map::get_index(imm->m_position, egbase().map().get_width()), + &imm->descr()); +} + +void Immovable::save(Editor_Game_Base* eg, Widelands_Map_Map_Object_Saver* mos, FileWrite& fw) +{ + // This is in front because it is required to obtain the descriptiong + // necessary to create the Immovable + fw.Unsigned8(header_Immovable); + fw.Unsigned8(IMMOVABLE_SAVEGAME_VERSION); + + if (const Tribe_Descr * const tribe = get_owner_tribe()) + fw.CString(tribe->name().c_str()); + else + fw.CString("world"); + + fw.CString(name().c_str()); + + // The main loading data follows + BaseImmovable::save(eg, mos, fw); + + fw.Coords32(m_position); + + // Animations + fw.CString(descr().get_animation_name(m_anim).c_str()); + fw.Signed32(m_animstart); + + // Program Stuff + if (m_program) { + fw.Unsigned8(1); + fw.CString(m_program->get_name().c_str()); + } else { + fw.Unsigned8(0); + } + + fw.Unsigned32(m_program_ptr); + fw.Signed32(m_program_step); +} + +Map_Object::Loader* Immovable::load + (Editor_Game_Base* eg, Widelands_Map_Map_Object_Loader* mol, FileRead& fr) +{ + Loader* loader = new Loader; + + try { + // The header has been peeled away by the caller + + Uint8 version = fr.Unsigned8(); + if (version != IMMOVABLE_SAVEGAME_VERSION) + throw wexception("Unknown version %u", version); + + const char * const owner = fr.CString (); + const char * const name = fr.CString (); + Immovable* imm = 0; + + if (strcmp(owner, "world")) { + // It is a tribe immovable + eg->manually_load_tribe(owner); + + Tribe_Descr* tribe = eg->get_tribe(owner); + if (!tribe) + throw wexception("Unknown tribe %s!\n", owner); + + int idx = tribe->get_immovable_index(name); + if (idx == -1) + throw wexception + ("Unknown tribe-immovable %s in map, asked for tribe: %s!\n", + name, owner); + + imm = new Immovable(*tribe->get_immovable_descr(idx)); + } else { + // World immovable + int idx = eg->map().world().get_immovable_index(name); + if (idx == -1) + throw wexception("Unknown world immovable %s in map!\n", name); + + imm = new Immovable(*eg->map().world().get_immovable_descr(idx)); + } + + loader->init(eg, mol, imm); + loader->load(fr); + } catch(const std::exception& e) { + delete loader; + throw wexception("Loading Immovable: %s", e.what()); + } catch(...) { + delete loader; + throw; + } + + return loader; +} + + /* =============== Modified: trunk/src/immovable.h =================================================================== --- trunk/src/immovable.h 2007-08-31 06:28:54 UTC (rev 2562) +++ trunk/src/immovable.h 2007-08-31 13:15:58 UTC (rev 2563) @@ -152,6 +152,22 @@ const ImmovableProgram * m_program; uint m_program_ptr; // index of next instruction to execute int m_program_step; // time of next step + + + // Load/save support +protected: + struct Loader : public BaseImmovable::Loader { + virtual void load(FileRead&); + virtual void load_pointers(); + virtual void load_finish(); + }; + +public: + // Remove as soon as we fully support the new system + virtual bool has_new_save_support() { return true; } + + virtual void save(Editor_Game_Base*, Widelands_Map_Map_Object_Saver*, FileWrite&); + static Map_Object::Loader* load(Editor_Game_Base*, Widelands_Map_Map_Object_Loader*, FileRead&); }; Modified: trunk/src/instances.cc =================================================================== --- trunk/src/instances.cc 2007-08-31 06:28:54 UTC (rev 2562) +++ trunk/src/instances.cc 2007-08-31 13:15:58 UTC (rev 2563) @@ -513,3 +513,69 @@ log("MO(%u): %s", m_serial, buffer); } + + +#define CURRENT_SAVEGAME_VERSION 1 + +/** + * Load the entire data package from the given file. + * This will be called from the Map_Object's derived class static load function. + * + * Derived functions must read all data into member variables, even if + * it is used only later in \ref load_pointers or \ref load_finish . + * + * Derived functions must call ancestor's function in the appropriate place. + */ +void Map_Object::Loader::load(FileRead& fr) +{ + Uint8 header = fr.Unsigned8(); + if (header != header_Map_Object) + throw wexception("Header %u expected (got %u)", header_Map_Object, header); + + Uint8 version = fr.Unsigned8(); + if (version != CURRENT_SAVEGAME_VERSION) + throw wexception("Map_Object: Unknown version %u", version); + + Uint32 fileindex = fr.Unsigned32(); + mol().register_object(&egbase(), fileindex, get_object()); + + egbase().objects().insert(get_object()); +} + + +/** + * This will be called after all instances have been loaded. + * + * This is where pointers to other instances should be established, possibly + * using data that was previously stored in a member variable by \ref load . + * + * Derived functions must call ancestor's function in the appropriate place. + */ +void Map_Object::Loader::load_pointers() +{ +} + + +/** + * This will be called after all instances have been load_pointer'ed. + * + * This is where dependent data (e.g. ware requests) should be checked and + * configured. + * + * Derived functions must call ancestor's function in the appropriate place. + */ +void Map_Object::Loader::load_finish() +{ +} + + +/** + * Save the Map_Object to the given file. + */ +void Map_Object::save(Editor_Game_Base*, Widelands_Map_Map_Object_Saver* mos, FileWrite& fw) +{ + fw.Unsigned8(header_Map_Object); + fw.Unsigned8(CURRENT_SAVEGAME_VERSION); + + fw.Unsigned32(mos->get_object_file_index(this)); +} Modified: trunk/src/instances.h =================================================================== --- trunk/src/instances.h 2007-08-31 06:28:54 UTC (rev 2562) +++ trunk/src/instances.h 2007-08-31 13:15:58 UTC (rev 2563) @@ -33,6 +33,7 @@ class RenderTarget; class Path; class Player; +struct Widelands_Map_Map_Object_Loader; namespace UI {struct Tab_Panel;}; // @@ -109,6 +110,12 @@ Use the appropriate type-dependent create() function for creation, and call die() for removal. Note that convenient creation functions are defined in class Game. + +When you do create a new object yourself (i.e. when you're implementing one +of the create() functions), you need to allocate the object using new, +potentially set it up by calling basic functions like set_position, set_owner, +etc. and then call init(). After that, the object is supposed to be fully +created. */ // If you find a better way to do this that doesn't cost a virtual function or additional @@ -200,6 +207,68 @@ void set_logsink(LogSink* sink); virtual void log_general_info(Editor_Game_Base*); // Called when a new logsink is set, used to give general informations + // saving and loading + /** + * Header bytes to distinguish between data packages for the different + * Map_Object classes. + * + * Be careful in changing those, since they are written to files. + */ + enum { + header_Map_Object = 1, + header_Immovable = 2 + }; + + /** + * Static load functions of derived classes will return a pointer to + * a Loader class. The caller needs to call the virtual functions + * \ref load for all instances loaded that way, after that call + * \ref load_pointers for all instances loaded that way and finally + * call \ref load_finish for all instances loaded that way. + * Those are the three phases of loading. After the last phase, + * all Loader objects should be deleted. + */ + class Loader { + Editor_Game_Base* m_egbase; + Widelands_Map_Map_Object_Loader* m_mol; + Map_Object* m_object; + + protected: + Loader() : m_egbase(0), m_mol(0), m_object(0) { } + + public: + virtual ~Loader() { } + + void init + (Editor_Game_Base* e, + Widelands_Map_Map_Object_Loader* m, + Map_Object* object) + { + m_egbase = e; + m_mol = m; + m_object = object; + } + + Editor_Game_Base& egbase() { return *m_egbase; } + Widelands_Map_Map_Object_Loader& mol() { return *m_mol; } + Map_Object* get_object() { return m_object; } + + protected: + virtual void load(FileRead&); + + public: + virtual void load_pointers(); + virtual void load_finish(); + }; + + // This is just a fail-safe guard for the time until we fully transition + // to the new Map_Object saving system + virtual bool has_new_save_support() { return false; } + + virtual void save(Editor_Game_Base*, Widelands_Map_Map_Object_Saver*, FileWrite&); + // Pure Map_Objects cannot be loaded + //static Loader* load(Editor_Game_Base*, Widelands_Map_Map_Object_Loader*); + protected: // init for editor and game virtual void init(Editor_Game_Base*); @@ -225,9 +294,9 @@ * Keeps the list of all objects currently in the game. */ class Object_Manager { +public: typedef std::map<uint, Map_Object *> objmap_t; -public: Object_Manager() {m_lastserial = 0;} ~Object_Manager(); @@ -250,6 +319,12 @@ return false; } + /** + * Get the map of all objects for the purpose of iterating over it. + * Only provide a const version of the map! + */ + const objmap_t& get_objects() { return m_objects; } + private: uint m_lastserial; objmap_t m_objects; Modified: trunk/src/widelands_map_immovable_data_packet.cc =================================================================== --- trunk/src/widelands_map_immovable_data_packet.cc 2007-08-31 06:28:54 UTC (rev 2562) +++ trunk/src/widelands_map_immovable_data_packet.cc 2007-08-31 13:15:58 UTC (rev 2563) @@ -55,7 +55,7 @@ assert(ol); FileRead fr; - fr.Open(fs, "binary/immovable"); + fr.Open(fs, "binary/immovable"); Map & map = egbase->map(); World & world = map.world (); @@ -105,41 +105,10 @@ * Write Function */ void Widelands_Map_Immovable_Data_Packet::Write -(FileSystem & fs, - Editor_Game_Base* egbase, - Widelands_Map_Map_Object_Saver * const os) +(FileSystem &, + Editor_Game_Base*, + Widelands_Map_Map_Object_Saver * const) throw (_wexception) { - FileWrite fw; - - // now packet version - fw.Unsigned16(CURRENT_PACKET_VERSION); - - const Map & map = egbase->map(); - const X_Coordinate mapwidth = map.get_width (); - const Y_Coordinate mapheight = map.get_height(); - Map::Index i = 0; - Coords position; - for (position.y = 0; position.y < mapheight; ++position.y) - for (position.x = 0; position.x < mapwidth; ++position.x, ++i) { - // We do not write player immovables - if - (const Immovable * const immovable = - dynamic_cast<const Immovable *>(map[i].get_immovable())) - { - assert(not os->is_object_known(immovable)); - fw.Unsigned32(os->register_object(immovable)); - if (const Tribe_Descr * const tribe = immovable->get_owner_tribe()) - fw.CString(tribe->name().c_str()); - else fw.CString("world"); - - fw.CString(immovable->name().c_str()); - fw.Coords32(position); - } - } - - fw.Unsigned32(0xffffffff); - - fw.Write(fs, "binary/immovable"); - // DONE + throw wexception("Immovable_Data_Packet is obsolete"); } Modified: trunk/src/widelands_map_immovabledata_data_packet.cc =================================================================== --- trunk/src/widelands_map_immovabledata_data_packet.cc 2007-08-31 06:28:54 UTC (rev 2562) +++ trunk/src/widelands_map_immovabledata_data_packet.cc 2007-08-31 13:15:58 UTC (rev 2563) @@ -123,50 +123,10 @@ * Write Function */ void Widelands_Map_Immovabledata_Data_Packet::Write -(FileSystem & fs, - Editor_Game_Base* egbase, - Widelands_Map_Map_Object_Saver * const os) +(FileSystem &, + Editor_Game_Base*, + Widelands_Map_Map_Object_Saver * const) throw (_wexception) { - FileWrite fw; - - // now packet version - fw.Unsigned16(CURRENT_PACKET_VERSION); - - Map* map=egbase->get_map(); - for (ushort y=0; y<map->get_height(); y++) { - for (ushort x=0; x<map->get_width(); x++) { - BaseImmovable* immovable=map->get_field(Coords(x, y))->get_immovable(); - - // We do not write player immovables - if (immovable && immovable->get_type()==Map_Object::IMMOVABLE) { - assert(os->is_object_known(immovable)); - Immovable* imm=static_cast<Immovable*>(immovable); - - fw.Unsigned32(os->get_object_file_index(imm)); - - // My position is not needed, set on creation - - // Animations - fw.CString(imm->descr().get_animation_name(imm->m_anim).c_str()); - fw.Signed32(imm->m_animstart); - - // Program Stuff - if (imm->m_program) { - fw.Unsigned8(1); - fw.CString(imm->m_program->get_name().c_str()); - } else - fw.Unsigned8(0); - fw.Unsigned32(imm->m_program_ptr); - fw.Signed32(imm->m_program_step); - - os->mark_object_as_saved(imm); - } - } - } - - fw.Unsigned32(0xffffffff); - - fw.Write(fs, "binary/immovable_data"); - // DONE + throw wexception("Immovable_Data_Packet is obsolete"); } Modified: trunk/src/widelands_map_loader.cc =================================================================== --- trunk/src/widelands_map_loader.cc 2007-08-31 06:28:54 UTC (rev 2562) +++ trunk/src/widelands_map_loader.cc 2007-08-31 13:15:58 UTC (rev 2563) @@ -43,6 +43,7 @@ #include "widelands_map_immovable_data_packet.h" #include "widelands_map_immovabledata_data_packet.h" #include "widelands_map_map_object_loader.h" +#include "widelands_map_object_packet.h" #include "widelands_map_objective_data_packet.h" #include "widelands_map_owned_fields_data_packet.h" #include "widelands_map_player_names_and_tribes_data_packet.h" @@ -166,12 +167,21 @@ log("done!\n "); // now immovables - log("Reading Immovable Data ... "); - { + bool have_immovables = m_fs.FileExists("binary/immovable"); + if (have_immovables) { + log("Reading Immovable Data ... "); Widelands_Map_Immovable_Data_Packet p; p.Read(m_fs, egbase, !scenario, m_mol); + log("done!\n "); + + if (m_fs.FileExists("binary/mapobjects")) + log("Warning: Map has both binary/immovable and binary/mapobjects\n"); + } else { + log("Reading Map Objects ... "); + Widelands_Map_Object_Packet p; + p.Read(m_fs, egbase, m_mol); + log("done\n"); } - log("done!\n "); // now player pos log("Reading Player Start Position Data ... "); @@ -341,6 +351,7 @@ log("Reading Immovabledata Data ... "); { + // We do this only for binary compatibility Widelands_Map_Immovabledata_Data_Packet p; p.Read(m_fs, egbase, !scenario, m_mol); } Added: trunk/src/widelands_map_object_packet.cc =================================================================== --- trunk/src/widelands_map_object_packet.cc (rev 0) +++ trunk/src/widelands_map_object_packet.cc 2007-08-31 13:15:58 UTC (rev 2563) @@ -0,0 +1,125 @@ +/* + * Copyright (C) 2007 by the Widelands Development Team + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#include "widelands_map_object_packet.h" + +#include "editor_game_base.h" +#include "error.h" +#include "fileread.h" +#include "filewrite.h" +#include "immovable.h" +#include "map.h" +#include "widelands_map_data_packet_ids.h" +#include "widelands_map_map_object_loader.h" +#include "widelands_map_map_object_saver.h" + + +#define CURRENT_PACKET_VERSION 1 + + +void Widelands_Map_Object_Packet::Read +(FileSystem & fs, + Editor_Game_Base* egbase, + Widelands_Map_Map_Object_Loader * const ol) +{ + typedef std::set<Map_Object::Loader*> LoaderSet; + LoaderSet loaders; + + try { + FileRead fr; + fr.Open(fs, "binary/mapobjects"); + + const Uint8 packet_version = fr.Unsigned8(); + if (packet_version != CURRENT_PACKET_VERSION) + throw wexception("Unknown version %u", packet_version); + + // Initial loading stage + for (;;) { + Uint8 header = fr.Unsigned8(); + if (!header) + break; + + switch(header) { + case Map_Object::header_Immovable: + loaders.insert(Immovable::load(egbase, ol, fr)); + break; + + default: + throw wexception("Unknown object header %u", header); + } + } + + // load_pointer stage + for(LoaderSet::const_iterator cit = loaders.begin(); cit != loaders.end(); ++cit) + (*cit)->load_pointers(); + + // load_finish stage + for(LoaderSet::const_iterator cit = loaders.begin(); cit != loaders.end(); ++cit) + (*cit)->load_finish(); + + // Cleanup + while(loaders.size()) { + delete *loaders.begin(); + loaders.erase(loaders.begin()); + } + } catch(const std::exception& e) { + while(loaders.size()) { + delete *loaders.begin(); + loaders.erase(loaders.begin()); + } + throw wexception("Loading map objects: %s", e.what()); + } catch(...) { + while(loaders.size()) { + delete *loaders.begin(); + loaders.erase(loaders.begin()); + } + throw; + } +} + + +void Widelands_Map_Object_Packet::Write +(FileSystem & fs, + Editor_Game_Base* egbase, + Widelands_Map_Map_Object_Saver * const os) +{ + FileWrite fw; + + fw.Unsigned8(CURRENT_PACKET_VERSION); + + const Object_Manager::objmap_t& objs = egbase->objects().get_objects(); + for(Object_Manager::objmap_t::const_iterator cit = objs.begin(); cit != objs.end(); ++cit) { + Map_Object* obj = cit->second; + + // These checks can be eliminated and the object saver simplified + // once all Map_Objects are saved using the new system + if (os->is_object_known(obj)) + continue; + + assert(obj->has_new_save_support()); + + os->register_object(obj); + obj->save(egbase, os, fw); + os->mark_object_as_saved(obj); + } + + fw.Unsigned8(0); + + fw.Write(fs, "binary/mapobjects"); +} Property changes on: trunk/src/widelands_map_object_packet.cc ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Added: trunk/src/widelands_map_object_packet.h =================================================================== --- trunk/src/widelands_map_object_packet.h (rev 0) +++ trunk/src/widelands_map_object_packet.h 2007-08-31 13:15:58 UTC (rev 2563) @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2007 by the Widelands Development Team + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#ifndef __S__WIDELANDS_MAP_OBJECT_PACKET_H +#define __S__WIDELANDS_MAP_OBJECT_PACKET_H + +class FileSystem; +class Editor_Game_Base; +class Widelands_Map_Map_Object_Loader; +class Widelands_Map_Map_Object_Saver; + +/** + * This data packet contains all \ref Map_Object and derived instances. + * + * \note Right now, only those Map_Objects not covered by other objects + * are in this packet. + */ +struct Widelands_Map_Object_Packet { + void Read + (FileSystem &, + Editor_Game_Base*, + Widelands_Map_Map_Object_Loader * const); + void Write + (FileSystem &, + Editor_Game_Base*, + Widelands_Map_Map_Object_Saver * const); +}; + + +#endif Property changes on: trunk/src/widelands_map_object_packet.h ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Modified: trunk/src/widelands_map_saver.cc =================================================================== --- trunk/src/widelands_map_saver.cc 2007-08-31 06:28:54 UTC (rev 2562) +++ trunk/src/widelands_map_saver.cc 2007-08-31 13:15:58 UTC (rev 2563) @@ -47,6 +47,7 @@ #include "widelands_map_immovable_data_packet.h" #include "widelands_map_immovabledata_data_packet.h" #include "widelands_map_map_object_saver.h" +#include "widelands_map_object_packet.h" #include "widelands_map_objective_data_packet.h" #include "widelands_map_owned_fields_data_packet.h" #include "widelands_map_player_names_and_tribes_data_packet.h" @@ -109,11 +110,6 @@ {Widelands_Map_Terrain_Data_Packet p; p.Write(m_fs, m_egbase, m_mos);} log("done!\n "); - // now immovables - log("Writing Immovable Data ... "); - {Widelands_Map_Immovable_Data_Packet p; p.Write(m_fs, m_egbase, m_mos);} - log("done!\n "); - // now player pos log("Writing Player Start Position Data ... "); { @@ -199,6 +195,13 @@ {Widelands_Map_Ware_Data_Packet p; p.Write(m_fs, m_egbase, m_mos);} log("done!\n "); + log("Writing Map Objects ... "); + { + Widelands_Map_Object_Packet p; + p.Write(m_fs, m_egbase, m_mos); + } + log("done!\n "); + // DATA PACKETS if (m_mos->get_nr_flags()) { log("Writing Flagdata Data ... "); @@ -235,15 +238,6 @@ log("done!\n "); } - if (m_mos->get_nr_immovables()) { - log("Writing Immovabledata Data ... "); - { - Widelands_Map_Immovabledata_Data_Packet p; - p.Write(m_fs, m_egbase, m_mos); - } - log("done!\n "); - } - log("Writing Owned-Fields Data ... "); {Widelands_Map_Owned_Fields_Data_Packet p; p.Write(m_fs, m_egbase, m_mos);} log("done!\n "); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |