#include <landmap.h>


Public Member Functions | |
| landmap () | |
| Default constructor. | |
| ~landmap () | |
| Destructor. | |
| void | clear () |
| Cleanup the map. | |
Map information | |
| u_int16 | nbr_of_mapobjects () const |
| Get the number of mapobjects that the map owns. | |
| u_int16 | nbr_of_submaps () const |
| Get the number of landsubmaps that the map owns. | |
| u_int16 | nbr_of_mapcharacters () const |
| Get the number of mapcharacters that are on this map. | |
| string | filename () const |
| Get the filename of the map, i.e the file from which it has been loaded (if any). | |
Individual map elements manipulation | |
Using these methods should be avoided as long as possible.
They are here for completeness, but their use should be exceptionnal. | |
| mapcharacter * | get_mapcharacter (u_int16 pos) |
| Returns a pointer to a mapcharacter on this landmap. | |
| mapobject * | get_mapobject (u_int16 pos) |
| Returns a pointer to a mapobject belonging to this landmap. | |
| mapsquare_area * | get_submap (u_int16 pos) |
| Returns a pointer to a submap belonging to this landmap. | |
State updating | |
| void | update () |
| Update the entire map (mapcharacters, mapobjects, etc. | |
Loading/Saving methods. | |
| s_int8 | get (igzstream &file) |
| Load a map from an opened file. | |
| s_int8 | load (string fname) |
| Load a map from a filename. | |
| s_int8 | put (ogzstream &file) const |
| Put a map into an opened file. | |
| s_int8 | save (string fname) |
| Save a map into a file. | |
State loading/saving methods. | |
| s_int8 | get_state (igzstream &file) |
| Restore the landmap's state from an opened file. | |
| s_int8 | put_state (ogzstream &file) const |
| Saves the landmap's state into an opened file. | |
Landmap modification | |
Although it should be very rare to modify a landmap during gameplay, these methods are here to allow you to safely to it. Be aware that they check if each element is in a safe state, and modify them if necessary. Therefore, they are quite slow and should be used in exceptionnal situations.
Note however that put_mapobject () and remove_mapobject () should be fast enough to allow real-time map modifications. But beware anyway. | |
| s_int8 | put_mapobject (u_int16 smap, u_int16 px, u_int16 py, u_int16 mobjnbr) |
| Put a mapobject on the map. | |
| void | remove_mapobject (u_int16 smap, u_int16 px, u_int16 py, u_int16 mobjnbr) |
| Remove a mapobject from the map. | |
| s_int8 | insert_submap (u_int16 pos) |
| Inserts an empty landsubmap into the landmap. | |
| s_int8 | delete_submap (u_int16 pos) |
| Remove a landsubmap from the landmap. | |
| s_int8 | insert_mapobject (mapobject *an, u_int16 pos, string srcfile="") |
| Adds a mapobject to a landmap. | |
| s_int8 | delete_mapobject (u_int16 pos) |
| Delete a mapobject from a landmap. | |
Friends | |
| class | mapcharacter |
| class | mapview |
This class handles everything that is needed for map display. More specifically, it includes:
Definition at line 52 of file landmap.h.
| landmap::landmap | ( | ) |
| landmap::~landmap | ( | ) |
| void landmap::clear | ( | ) |
Cleanup the map.
Totally cleanup a map, that is deleting every mapobject/mapcharacter/landsubmap it contains, and reset it to a stable state (just like it has just been created).
Reimplemented from event_list.
Definition at line 37 of file landmap.cc.
| u_int16 landmap::nbr_of_mapobjects | ( | ) | const [inline] |
| u_int16 landmap::nbr_of_submaps | ( | ) | const [inline] |
| u_int16 landmap::nbr_of_mapcharacters | ( | ) | const [inline] |
| string landmap::filename | ( | ) | const [inline] |
| mapcharacter* landmap::get_mapcharacter | ( | u_int16 | pos | ) | [inline] |
Returns a pointer to a mapcharacter on this landmap.
| pos | index of the mapcharacter to return. |
| mapobject* landmap::get_mapobject | ( | u_int16 | pos | ) | [inline] |
| mapsquare_area* landmap::get_submap | ( | u_int16 | pos | ) | [inline] |
| void landmap::update | ( | ) |
Update the entire map (mapcharacters, mapobjects, etc.
.. of 1 cycle.
Definition at line 65 of file landmap.cc.
| s_int8 landmap::get | ( | igzstream & | file | ) |
Load a map from an opened file.
| file | the file from which to load. |
Definition at line 78 of file landmap.cc.
| s_int8 landmap::load | ( | string | fname | ) |
Load a map from a filename.
| fname | the filename from which to load. |
Definition at line 127 of file landmap.cc.
| s_int8 landmap::put | ( | ogzstream & | file | ) | const |
Put a map into an opened file.
| file | the file where to save. |
Definition at line 144 of file landmap.cc.
| s_int8 landmap::save | ( | string | fname | ) |
Save a map into a file.
| fname | the filename where to save. |
Definition at line 193 of file landmap.cc.
| s_int8 landmap::get_state | ( | igzstream & | file | ) |
Restore the landmap's state from an opened file.
| file | the opened file from which to load the state. |
Reimplemented from event_list.
Definition at line 207 of file landmap.cc.
| s_int8 landmap::put_state | ( | ogzstream & | file | ) | const |
Saves the landmap's state into an opened file.
| file | the opened file where to the state. |
Reimplemented from event_list.
Definition at line 232 of file landmap.cc.
| s_int8 landmap::put_mapobject | ( | u_int16 | smap, | |
| u_int16 | px, | |||
| u_int16 | py, | |||
| u_int16 | mobjnbr | |||
| ) |
| void landmap::remove_mapobject | ( | u_int16 | smap, | |
| u_int16 | px, | |||
| u_int16 | py, | |||
| u_int16 | mobjnbr | |||
| ) |
| s_int8 landmap::insert_submap | ( | u_int16 | pos | ) |
Inserts an empty landsubmap into the landmap.
The landmap can then be accessed for resizing with get_submap ()
| pos | the position where to insert the submap. |
Definition at line 317 of file landmap.cc.
| s_int8 landmap::delete_submap | ( | u_int16 | pos | ) |
Remove a landsubmap from the landmap.
| pos | the index of the submap to remove |
Definition at line 337 of file landmap.cc.
| s_int8 landmap::insert_mapobject | ( | mapobject * | an, | |
| u_int16 | pos, | |||
| string | srcfile = "" | |||
| ) |
| s_int8 landmap::delete_mapobject | ( | u_int16 | pos | ) |
Delete a mapobject from a landmap.
| pos | the index of the mapobject to delete. |
Definition at line 277 of file landmap.cc.
1.5.6