Go to the documentation of this file.
47 while (mapchar.size ())
48 mapchar.front ()->remove_from_map ();
51 vector <mapobject *>::iterator io;
52 for (io = mobj.begin (); io != mobj.end (); io++)
60 vector <mapsquare_area *>::iterator is;
61 for (is = submap.begin (); is != submap.end (); is++)
72 vector <mapobject *>::iterator io;
73 for (io = mobj.begin (); io != mobj.end (); io++)
77 vector <mapcharacter *>::iterator ic;
78 for (ic = mapchar.begin (); ic != mapchar.end (); ic++)
101 for (j = 0; j < i; j++)
114 sm->area[k][l].can_use_for_pathfinding << file;
122 sm->put_mapobject (k, l, mobj[t]);
142 retvalue =
get (file);
165 submap[i]->area_length () >> file;
166 submap[i]->area_height () >> file;
168 for (l = 0; l < submap[i]->area_height (); l++)
169 for (k = 0; k < submap[i]->area_length (); k++)
172 submap[i]->area[k][l].can_use_for_pathfinding >> file;
173 list <mapsquare_tile>::iterator it = submap[i]->area[k][l].tiles.begin ();
174 while (it != submap[i]->area[k][l].tiles.end ())
176 if (it->is_base) nbr_base++;
181 it = submap[i]->area[k][l].tiles.begin ();
182 while (it != submap[i]->area[k][l].tiles.end ())
187 while (mobj[y] != (*it).mapobj) y++;
205 retvalue =
put (file);
224 for (
u_int16 i = 0; i < nbr_of; i++)
247 for (
u_int16 i = 0; i < nbr_of; i++)
266 vector <mapobject *>::iterator i = mobj.begin ();
267 vector <string>::iterator j = mobjsrc.begin ();
276 mobjsrc.insert (j, srcfile);
291 for (i = 0; i < submap[k]->area_length (); i++)
292 for (j = 0; j < submap[k]->area_height (); j++)
295 list <mapsquare_tile>::iterator imt;
296 for (imt = ms.tiles.begin (); imt != ms.tiles.end (); imt++)
297 if (imt->mapobj == dptr)
302 imt = ms.tiles.begin ();
307 vector <mapobject *>::iterator i;
327 vector <mapcharacter *>::iterator ic;
328 for (ic = mapchar.begin (); ic != mapchar.end (); ic++)
329 if ((*ic)->submap_ >= pos) (*ic)->submap_++;
332 vector <mapsquare_area *>::iterator i = submap.begin ();
336 submap.insert (i, t);
345 vector <mapcharacter *>::iterator ic;
346 for (ic = mapchar.begin (); ic != mapchar.end (); ic++)
348 if ((*ic)->submap_ > pos) (*ic)->submap_--;
349 else if ((*ic)->submap_ == pos)
350 (*ic)->remove_from_map ();
354 vector <mapsquare_area *>::iterator i;
371 return submap[smap]->put_mapobject (px, py, mobj[mobjnbr]);
377 submap[smap]->remove_mapobject (px, py, mobj[mobjnbr]);
void clear()
Unregisters and deletes all events owned by this list.
u_int16 area_height() const
Returns the height of the area.
s_int8 delete_mapobject(u_int16 pos)
Delete a mapobject from a landmap.
Class to read data from a Gzip compressed file.
Stores objects of any kind.
s_int8 put_state(ogzstream &file) const
Saves the landmap's state into an opened file.
u_int16 area_length() const
Returns the length of the area.
u_int16 nbr_of_submaps() const
Get the number of landsubmaps that the map owns.
Base class for objects that want to register events.
#define MAPS_DIR
Subdirectory where maps are saved.
s_int8 get(igzstream &file)
Load a map from an opened file.
s_int8 put(ogzstream &file) const
Put a map into an opened file.
Class to write data from a Gzip compressed file.
s_int8 get_state(igzstream &file)
Restore the landmap's state from an opened file.
#define u_int8
8 bits long unsigned integer
static void put_version(ogzstream &file, u_int16 version)
Sets the version number of a file.
s_int8 insert_submap(u_int16 pos)
Inserts an empty landsubmap into the landmap.
landmap()
Default constructor.
s_int8 load(string fname)
Load a map from a filename.
bool get_state(igzstream &in)
Loads the event_list from a file and registers all loaded events.
bool is_open()
Returns whether the file is opened or not.
void close()
Close the file that was opened.
s_int8 insert_mapobject(mapobject *an, u_int16 pos, string srcfile="")
Adds a mapobject to a landmap.
#define s_int8
8 bits long signed integer
Declares the character class.
Area of mapsquares, for use with landmap.
u_int16 nbr_of_mapobjects() const
Get the number of mapobjects that the map owns.
bool open(const string &fname)
Opens a file for read access.
void set_map(landmap *m)
Puts the mapcharacter on a landmap.
void update()
Update the entire map (mapcharacters, mapobjects, etc...
static bool get_version(igzstream &file, u_int16 min, u_int16 max, string name)
s_int8 put_state(ogzstream &file) const
Saves the mapcharacter's state into an opened file.
s_int8 get_state(igzstream &file)
Restore the mapcharacter's state from an opened file.
u_int16 nbr_of_mapcharacters() const
Get the number of mapcharacters that are on this map.
Representation of characters on a landmap.
string get_id()
Returns an unique identifier of the character.
#define u_int16
16 bits long unsigned integer
Objects that can be placed on a landmap.
s_int8 load(string fname)
Loads a mapobject from it's filename.
void clear()
Cleanup the map.
Base unit of a landsubmap, where you can place mapobjects or mapcharacters.
s_int8 delete_submap(u_int16 pos)
Remove a landsubmap from the landmap.
void remove_mapobject(u_int16 smap, u_int16 px, u_int16 py, u_int16 mobjnbr)
Remove a mapobject from the map.
void resize_area(u_int16 nl, u_int16 nh)
Resize the area.
void put_state(ogzstream &out) const
Save the event_list to a file.
s_int8 put_mapobject(u_int16 smap, u_int16 px, u_int16 py, u_int16 mobjnbr)
Put a mapobject on the map.
s_int8 save(string fname)
Save a map into a file.