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. | |
mapsquare (const mapsquare &src) | |
Copy constructor. | |
~mapsquare () | |
Destructor. | |
u_int16 | x () |
Returns the X position of this mapsquare. | |
u_int16 | y () |
Returns the Y position of this mapsquare. | |
bool | is_free () |
Returns whether the mapsquare is free for a character to go on or not. | |
mapcharacter * | whoshere () |
Return a pointer to the mapcharacter that occupies this mapsquare. | |
Public Attributes | |
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. | |
u_int16 | h |
Estimated distance to the goal square. | |
u_int16 | f |
Sum of g + h. | |
mapsquare * | parent |
Parent square for the path. | |
bool | can_use_for_pathfinding |
If == false, then this square will never be considered as walkable by pathfinding functions. | |
Friends | |
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 230 of file mapsquare.h.
Default constructor.
Definition at line 50 of file mapsquare.cc.
mapsquare::mapsquare | ( | const mapsquare & | src | ) |
Copy constructor.
Definition at line 56 of file mapsquare.cc.
Destructor.
Definition at line 69 of file mapsquare.cc.
u_int16 mapsquare::x | ( | ) | [inline] |
Returns the X position of this mapsquare.
Definition at line 259 of file mapsquare.h.
u_int16 mapsquare::y | ( | ) | [inline] |
Returns the Y position of this mapsquare.
Definition at line 270 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 73 of file mapsquare.cc.
Return a pointer to the mapcharacter that occupies this mapsquare.
Definition at line 82 of file mapsquare.cc.
Distance from the source square.
Definition at line 307 of file mapsquare.h.
Estimated distance to the goal square.
Definition at line 313 of file mapsquare.h.
Sum of g + h.
Definition at line 319 of file mapsquare.h.
If == false, then this square will never be considered as walkable by pathfinding functions.
Definition at line 332 of file mapsquare.h.