43 while (mapchar.size ())
44 mapchar.front ()->remove_from_map ();
47 vector <mapobject *>::iterator io;
48 for (io = mobj.begin (); io != mobj.end (); io++)
56 vector <mapsquare_area *>::iterator is;
57 for (is = submap.begin (); is != submap.end (); is++)
68 vector <mapobject *>::iterator io;
69 for (io = mobj.begin (); io != mobj.end (); io++)
73 vector <mapcharacter *>::iterator ic;
74 for (ic = mapchar.begin (); ic != mapchar.end (); ic++)
97 for (j = 0; j < i; j++)
110 sm->area[k][l].can_use_for_pathfinding << file;
118 sm->put_mapobject (k, l, mobj[t]);
138 retvalue =
get (file);
161 submap[i]->area_length () >> file;
162 submap[i]->area_height () >> file;
164 for (l = 0; l < submap[i]->area_height (); l++)
165 for (k = 0; k < submap[i]->area_length (); k++)
168 submap[i]->area[k][l].can_use_for_pathfinding >> file;
169 list <mapsquare_tile>::iterator it = submap[i]->area[k][l].tiles.begin ();
170 while (it != submap[i]->area[k][l].tiles.end ())
172 if (it->is_base) nbr_base++;
177 it = submap[i]->area[k][l].tiles.begin ();
178 while (it != submap[i]->area[k][l].tiles.end ())
183 while (mobj[y] != (*it).mapobj) y++;
201 retvalue =
put (file);
220 for (
u_int16 i = 0; i < nbr_of; i++)
243 for (
u_int16 i = 0; i < nbr_of; i++)
262 vector <mapobject *>::iterator i = mobj.begin ();
263 vector <string>::iterator j = mobjsrc.begin ();
272 mobjsrc.insert (j, srcfile);
287 for (i = 0; i < submap[k]->area_length (); i++)
288 for (j = 0; j < submap[k]->area_height (); j++)
291 list <mapsquare_tile>::iterator imt;
292 for (imt = ms.tiles.begin (); imt != ms.tiles.end (); imt++)
293 if (imt->mapobj == dptr)
298 imt = ms.tiles.begin ();
303 vector <mapobject *>::iterator i;
323 vector <mapcharacter *>::iterator ic;
324 for (ic = mapchar.begin (); ic != mapchar.end (); ic++)
325 if ((*ic)->submap_ >= pos) (*ic)->submap_++;
328 vector <mapsquare_area *>::iterator i = submap.begin ();
332 submap.insert (i, t);
341 vector <mapcharacter *>::iterator ic;
342 for (ic = mapchar.begin (); ic != mapchar.end (); ic++)
344 if ((*ic)->submap_ > pos) (*ic)->submap_--;
345 else if ((*ic)->submap_ == pos)
346 (*ic)->remove_from_map ();
350 vector <mapsquare_area *>::iterator i;
367 return submap[smap]->put_mapobject (px, py, mobj[mobjnbr]);
373 submap[smap]->remove_mapobject (px, py, mobj[mobjnbr]);
Declares the character class.
Class to write data from a Gzip compressed file.
void close()
Close the file that was opened.
void clear()
Unregisters and deletes all events owned by this list.
#define MAPS_DIR
Subdirectory where maps are saved.
Class to read data from a Gzip compressed file.
s_int8 delete_mapobject(u_int16 pos)
Delete a mapobject from a landmap.
#define u_int16
16 bits long unsigned integer
s_int8 load(string fname)
Loads a mapobject from it's filename.
u_int16 area_height() const
Returns the height of the area.
s_int8 put_state(ogzstream &file) const
Saves the landmap's state into an opened file.
string get_id()
Returns an unique identifier of the character.
s_int8 put(ogzstream &file) const
Put a map into an opened file.
landmap()
Default constructor.
s_int8 insert_mapobject(mapobject *an, u_int16 pos, string srcfile="")
Adds a mapobject to a landmap.
#define u_int8
8 bits long unsigned integer
u_int16 nbr_of_mapobjects() const
Get the number of mapobjects that the map owns.
bool get_state(igzstream &in)
Loads the event_list from a file and registers all loaded events.
u_int16 area_length() const
Returns the length of the area.
void put_state(ogzstream &out) const
Save the event_list to a file.
Declares the landmap class.
s_int8 insert_submap(u_int16 pos)
Inserts an empty landsubmap into the landmap.
bool open(const string &fname)
Opens a file for read access.
static bool get_version(igzstream &file, u_int16 min, u_int16 max, string name)
s_int8 save(string fname)
Save a map into a file.
s_int8 put_mapobject(u_int16 smap, u_int16 px, u_int16 py, u_int16 mobjnbr)
Put a mapobject on the map.
void update()
Update the entire map (mapcharacters, mapobjects, etc...
bool is_open()
Returns whether the file is opened or not.
s_int8 get(igzstream &file)
Load a map from an opened file.
Base unit of a landsubmap, where you can place mapobjects or mapcharacters.
s_int8 load(string fname)
Load a map from a filename.
u_int16 nbr_of_mapcharacters() const
Get the number of mapcharacters that are on this map.
void resize_area(u_int16 nl, u_int16 nh)
Resize the area.
void set_map(landmap *m)
Puts the mapcharacter on a landmap.
Representation of characters on a landmap.
void remove_mapobject(u_int16 smap, u_int16 px, u_int16 py, u_int16 mobjnbr)
Remove a mapobject from the map.
s_int8 put_state(ogzstream &file) const
Saves the mapcharacter's state into an opened file.
static void put_version(ogzstream &file, u_int16 version)
Sets the version number of a file.
void clear()
Cleanup the map.
Base class for objects that want to register events.
s_int8 get_state(igzstream &file)
Restore the landmap's state from an opened file.
s_int8 delete_submap(u_int16 pos)
Remove a landsubmap from the landmap.
u_int16 nbr_of_submaps() const
Get the number of landsubmaps that the map owns.
#define s_int8
8 bits long signed integer
Objects that can be placed on a landmap.
s_int8 get_state(igzstream &file)
Restore the mapcharacter's state from an opened file.
Area of mapsquares, for use with landmap.