Adonthell
0.4
|
Base unit of a landsubmap, where you can place mapobjects or mapcharacters. More...
#include <mapsquare.h>
Public Member Functions | |
mapsquare () | |
Default constructor. More... | |
mapsquare (const mapsquare &src) | |
Copy constructor. More... | |
~mapsquare () | |
Destructor. More... | |
u_int16 | x () |
Returns the X position of this mapsquare. More... | |
u_int16 | y () |
Returns the Y position of this mapsquare. More... | |
bool | is_free () |
Returns whether the mapsquare is free for a character to go on or not. More... | |
mapcharacter * | whoshere () |
Return a pointer to the mapcharacter that occupies this mapsquare. More... | |
![]() | |
mapsquare_walkable () | |
Default constructor. More... | |
s_int8 | get (igzstream &file) |
Loads a mapsquare_walkable from an opened file. More... | |
s_int8 | put (ogzstream &file) const |
Puts a mapsquare_walkable into an opened file. More... | |
bool | is_walkable_west () const |
Returns whether a mapsquare is walkable from west. More... | |
bool | is_walkable_east () const |
Returns whether a mapsquare is walkable from east. More... | |
bool | is_walkable_north () const |
Returns whether a mapsquare is walkable from north. More... | |
bool | is_walkable_south () const |
Returns whether a mapsquare is walkable from south. More... | |
void | set_walkable_west (bool w) |
Sets the reachability from west of a mapsquare. More... | |
void | set_walkable_east (bool w) |
Sets the reachability from east of a mapsquare. More... | |
void | set_walkable_north (bool w) |
Sets the reachability from north of a mapsquare. More... | |
void | set_walkable_south (bool w) |
Sets the reachability from south of a mapsquare. More... | |
u_int8 | get_walkable () const |
Gets the raw walkable parameter of a mapsquare. More... | |
void | set_walkable (u_int8 w) |
Sets the walkable parameter of a mapsquare. More... | |
Pathfinding data members. | |
These members are here to allow faster and more efficient pathfinding. Though they can as well be used for something else, but their value isn't guaranteed to stay constant. It is safe to modify them however, so they are public and uninitialised. | |
u_int16 | g |
Distance from the source square. More... | |
u_int16 | h |
Estimated distance to the goal square. More... | |
u_int16 | f |
Sum of g + h. More... | |
mapsquare * | parent |
Parent square for the path. More... | |
bool | can_use_for_pathfinding |
If == false, then this square will never be considered as walkable by pathfinding functions. More... | |
class | mapcharacter |
class | mapsquare_area |
class | landmap |
class | mapview |
Base unit of a landsubmap, where you can place mapobjects or mapcharacters.
A landsubmap is a 2 dimensionnal array of mapsquares. When a mapobject is placed on a landsubmap, it belongs to one or several mapsquares. A mapsquare is made of a list of mapsquare_tiles, containing informations about the objects that are on it, and a list of mapsquare_char, which informs about the mapcharacters here. This make it possible to have several mapobjects and mapcharacters on the same mapsquare.
These two lists are sorted by the position of the object or mapcharacter's base square on the map. This make it fast to iterate through the lists during drawing, as we always want to iterate the list in this order.
Definition at line 234 of file mapsquare.h.
mapsquare::mapsquare | ( | ) |
Default constructor.
Definition at line 54 of file mapsquare.cc.
mapsquare::mapsquare | ( | const mapsquare & | src | ) |
Copy constructor.
Definition at line 60 of file mapsquare.cc.
mapsquare::~mapsquare | ( | ) |
Destructor.
Definition at line 73 of file mapsquare.cc.
|
inline |
Returns the X position of this mapsquare.
Definition at line 263 of file mapsquare.h.
|
inline |
Returns the Y position of this mapsquare.
Definition at line 274 of file mapsquare.h.
bool mapsquare::is_free | ( | ) |
Returns whether the mapsquare is free for a character to go on or not.
It only checks if a mapcharacter is already here. It doesn't deal with the walkable problem.
Definition at line 77 of file mapsquare.cc.
mapcharacter * mapsquare::whoshere | ( | ) |
Return a pointer to the mapcharacter that occupies this mapsquare.
Definition at line 86 of file mapsquare.cc.
u_int16 mapsquare::g |
Distance from the source square.
Definition at line 311 of file mapsquare.h.
u_int16 mapsquare::h |
Estimated distance to the goal square.
Definition at line 317 of file mapsquare.h.
u_int16 mapsquare::f |
Sum of g + h.
Definition at line 323 of file mapsquare.h.
mapsquare* mapsquare::parent |
Parent square for the path.
Definition at line 329 of file mapsquare.h.
bool mapsquare::can_use_for_pathfinding |
If == false, then this square will never be considered as walkable by pathfinding functions.
Definition at line 336 of file mapsquare.h.