128
128
for (uint16_t x = 0; x < map.get_width(); ++x) {
129
129
uint32_t const nr_bobs = fr.Unsigned32();
131
assert(!map[Coords(x, y)].get_first_bob());
133
131
for (uint32_t i = 0; i < nr_bobs; ++i)
134
132
ReadBob(fr, egbase, skip, mol, Coords(x, y));
147
145
(FileSystem & fs, Editor_Game_Base & egbase, Map_Map_Object_Saver & mos)
148
146
throw (_wexception)
152
// now packet version
153
fw.Unsigned16(CURRENT_PACKET_VERSION);
155
// Now, all bob id and registerd it
156
// A Field can have more
157
// than one bob, we have to take this into account
158
// uint8_t numbers of bob for field
163
Map & map = egbase.map();
164
for (uint16_t y = 0; y < map.get_height(); ++y) {
165
for (uint16_t x = 0; x < map.get_width(); ++x) {
166
std::vector<Bob *> bobarr;
168
map.find_bobs // FIXME clean up this mess!
169
(Area<FCoords>(map.get_fcoords(Coords(x, y)), 0), &bobarr);
170
fw.Unsigned32(bobarr.size());
172
for (uint32_t i = 0; i < bobarr.size(); ++i) {
173
// write serial number
175
// a bob can not be owned by two nodes
176
assert(not mos.is_object_known(*bobarr[i]));
178
Serial const reg = mos.register_object(*bobarr[i]);
181
std::string owner_tribe =
182
bobarr[i]->descr().get_owner_tribe() ?
183
bobarr[i]->descr().get_owner_tribe()->name() : "world";
184
fw.String(owner_tribe);
186
fw.String(bobarr[i]->name());
187
// Write it's subtype
188
fw.Unsigned8(bobarr[i]->get_bob_type());
189
// And it's file register index
195
fw.Write(fs, "binary/bob");
148
throw wexception("bob packet is deprecated");