|
Adonthell
0.4
|
Map where the world takes place. More...
#include <landmap.h>


Public Member Functions | |
| landmap () | |
| Default constructor. More... | |
| ~landmap () | |
| Destructor. More... | |
| void | clear () |
| Cleanup the map. More... | |
Map information | |
| u_int16 | nbr_of_mapobjects () const |
| Get the number of mapobjects that the map owns. More... | |
| u_int16 | nbr_of_submaps () const |
| Get the number of landsubmaps that the map owns. More... | |
| u_int16 | nbr_of_mapcharacters () const |
| Get the number of mapcharacters that are on this map. More... | |
| string | filename () const |
| Get the filename of the map, i.e the file from which it has been loaded (if any). More... | |
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. More... | |
| mapobject * | get_mapobject (u_int16 pos) |
| Returns a pointer to a mapobject belonging to this landmap. More... | |
| mapsquare_area * | get_submap (u_int16 pos) |
| Returns a pointer to a submap belonging to this landmap. More... | |
State updating | |
| void | update () |
| Update the entire map (mapcharacters, mapobjects, etc... More... | |
Loading/Saving methods. | |
| s_int8 | get (igzstream &file) |
| Load a map from an opened file. More... | |
| s_int8 | load (string fname) |
| Load a map from a filename. More... | |
| s_int8 | put (ogzstream &file) const |
| Put a map into an opened file. More... | |
| s_int8 | save (string fname) |
| Save a map into a file. More... | |
State loading/saving methods. | |
| s_int8 | get_state (igzstream &file) |
| Restore the landmap's state from an opened file. More... | |
| s_int8 | put_state (ogzstream &file) const |
| Saves the landmap's state into an opened file. More... | |
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. More... | |
| void | remove_mapobject (u_int16 smap, u_int16 px, u_int16 py, u_int16 mobjnbr) |
| Remove a mapobject from the map. More... | |
| s_int8 | insert_submap (u_int16 pos) |
| Inserts an empty landsubmap into the landmap. More... | |
| s_int8 | delete_submap (u_int16 pos) |
| Remove a landsubmap from the landmap. More... | |
| s_int8 | insert_mapobject (mapobject *an, u_int16 pos, string srcfile="") |
| Adds a mapobject to a landmap. More... | |
| s_int8 | delete_mapobject (u_int16 pos) |
| Delete a mapobject from a landmap. More... | |
Public Member Functions inherited from event_list | |
| event_list () | |
| Constructor - creates an empty, unpaused event_list. More... | |
| virtual | ~event_list () |
| Destructor - unregisters and deletes all events owned by this list. More... | |
| void | clear () |
| Unregisters and deletes all events owned by this list. More... | |
| void | add_event (event *ev) |
| Adds an event to this list. More... | |
| void | remove_event (event *ev) |
| Removes an event from the list. More... | |
| event * | get_event (const string &id) |
| Try to retrieve the event with given id from the list. More... | |
| void | pause () |
| Disable any events associated with this event_list. More... | |
| void | resume () |
| Re-enable the events associated with the event_list, thus 'awaking' the object to life again. More... | |
| bool | is_paused () const |
| Check whether the event list is temporarily disabled or not. More... | |
| void | put_state (ogzstream &out) const |
| Save the event_list to a file. More... | |
| bool | get_state (igzstream &in) |
| Loads the event_list from a file and registers all loaded events. More... | |
Friends | |
| class | mapcharacter |
| class | mapview |
Additional Inherited Members | |
Static Public Member Functions inherited from event_list | |
| static void | register_event (u_int8 type, new_event e) |
| Register an event for loading. More... | |
Protected Attributes inherited from event_list | |
| std::vector< event * > | Events |
| List of events. More... | |
Map where the world takes place.
This class handles everything that is needed for map display. More specifically, it includes:
This class is responsible for the storage of it's submaps and mapobjects, but NOT mapcharacters. So be sure to delete () yourself your mapcharacters when you don't need them anymore.
| landmap::landmap | ( | ) |
Default constructor.
Definition at line 28 of file landmap.cc.
| landmap::~landmap | ( | ) |
Destructor.
Definition at line 32 of file landmap.cc.
| 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).
Definition at line 37 of file landmap.cc.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
| void landmap::update | ( | ) |
Update the entire map (mapcharacters, mapobjects, etc...
of 1 cycle.
Definition at line 65 of file landmap.cc.
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.
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.
Restore the landmap's state from an opened file.
| file | the opened file from which to load the state. |
Definition at line 207 of file landmap.cc.
Saves the landmap's state into an opened file.
| file | the opened file where to the state. |
Definition at line 232 of file landmap.cc.
Put a mapobject on the map.
| smap | index of the submap to put the object on. |
| px | X position to put the mapobject on |
| py | Y position to put the mapobject on. |
| mobjnbr | index of the mapobject to put. |
Definition at line 364 of file landmap.cc.
Remove a mapobject from the map.
| smap | index of the submap to remove the object on. |
| px | X position of the mapobject. |
| py | Y position of the mapobject. |
| mobjnbr | index of the mapobject to remove. |
Definition at line 370 of file landmap.cc.
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.
Remove a landsubmap from the landmap.
| pos | the index of the submap to remove |
Definition at line 337 of file landmap.cc.
Adds a mapobject to a landmap.
| an | the mapobject to insert. |
| pos | the position where to insert the mapobject. |
| srcfile | the name of the file where the mapobject come from. |
Definition at line 256 of file landmap.cc.
Delete a mapobject from a landmap.
| pos | the index of the mapobject to delete. |
Definition at line 277 of file landmap.cc.