mapsquare Class Reference

Base unit of a landsubmap, where you can place mapobjects or mapcharacters. More...

#include <mapsquare.h>

Inheritance diagram for mapsquare:

Inheritance graph
[legend]
Collaboration diagram for mapsquare:

Collaboration graph
[legend]

List of all members.

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.
mapcharacterwhoshere ()
 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.
mapsquareparent
 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


Detailed Description

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.


Constructor & Destructor Documentation

mapsquare::mapsquare (  ) 

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.

mapsquare::~mapsquare (  ) 

Destructor.

Definition at line 69 of file mapsquare.cc.


Member Function Documentation

u_int16 mapsquare::x (  )  [inline]

Returns the X position of this mapsquare.

Returns:
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.

Returns:
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.

Returns:

Definition at line 73 of file mapsquare.cc.

mapcharacter * mapsquare::whoshere (  ) 

Return a pointer to the mapcharacter that occupies this mapsquare.

Returns:
pointer to the mapcharacter that occupies the mapsquare, NULL if none.

Definition at line 82 of file mapsquare.cc.


Member Data Documentation

u_int16 mapsquare::g

Distance from the source square.

Definition at line 307 of file mapsquare.h.

u_int16 mapsquare::h

Estimated distance to the goal square.

Definition at line 313 of file mapsquare.h.

u_int16 mapsquare::f

Sum of g + h.

Definition at line 319 of file mapsquare.h.

Parent square for the path.

Definition at line 325 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.


The documentation for this class was generated from the following files:

Generated on Wed Jun 18 16:55:38 2008 for Adonthell by  doxygen 1.5.6