#include <Unit.h>
Inherits GameEntity.
Inheritance diagram for Unit:

Definition at line 13 of file Unit.h.
Public Member Functions | |
| bool | canMoveInDirection (Direction dir) |
| void | clearMovePath () |
| void | computeMovePath (spMapTile dest) |
| void | draw (Point offset, Point dimensions) const |
| void | drawMovePath (Point offset) const |
| const spMapTile | getDestination () const |
| int | getPlayerID () const |
| map< spMapTile, int > | getPossibleMoves () |
| int | getX () const |
| int | getY () const |
| bool | hasMaxActionPoints () const |
| bool | hasMovePath () const |
| bool | hasTurnBefore (spUnit u) const |
| bool | isPassable () const |
| void | markActive () |
| void | markSelected () |
| void | move (spMapTile tile) |
| void | move (Direction dir) |
| void | moveAlongPath (bool teleport=false) |
| void | regenActionPoints () |
| void | updatePossibleMoves () |
| void | wait () |
| virtual | ~Unit () |
Static Public Member Functions | |
| static void | clearActive () |
| static void | clearSelected () |
| static spUnit | getSelectedUnit () |
| static spUnit | makeUnit (int playerID, spMapTile) |
| static spUnit | makeUnit (int playerID) |
Private Member Functions | |
| bool | canMoveInDirection (spMapTile tile, Direction dir, int points) |
| pair< spMapTile, int > | computeMovePathHelper (spMapTile current) |
| Unit (int playerID, spMapTile tile) | |
Private Attributes | |
| int | _actionPoints |
| list< pair< spMapTile, int > > | _movementPath |
| int | _playerID |
| map< spMapTile, int > | _possibleMoves |
| int | _regenRate |
| spMapTile | _tile |
| wpUnit | _weak |
Static Private Attributes | |
| static SDL_Surface * | _activeImage = NULL |
| static spUnit | _activeUnit |
| static SDL_Surface * | _image = NULL |
| static int | _maxActionPoints = 50 |
| static SDL_Surface * | _pathEndImage = NULL |
| static SDL_Surface * | _pathImage = NULL |
| static SDL_Surface * | _selectedImage = NULL |
| static spUnit | _selectedUnit |
| Unit::Unit | ( | int | playerID, | |
| spMapTile | tile | |||
| ) | [private] |
Definition at line 42 of file Unit.cpp.
References _activeImage, _image, _pathEndImage, _pathImage, _selectedImage, _tile, Singleton< T >::instance(), UNIT_ACTIVE_IMAGE, UNIT_IMAGE, UNIT_PATH_END_IMAGE, UNIT_PATH_IMAGE, and UNIT_SELECTED_IMAGE.
Referenced by makeUnit().
Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 140 of file Unit.cpp.
References _tile, Direction::E, getX(), getY(), Direction::N, Direction::NE, Direction::NW, Direction::S, Direction::SE, Direction::SW, and Direction::W.
Here is the call graph for this function:

| bool Unit::canMoveInDirection | ( | Direction | dir | ) |
Definition at line 135 of file Unit.cpp.
References _actionPoints, and _tile.
Referenced by computeMovePathHelper(), move(), and updatePossibleMoves().
Here is the caller graph for this function:

| void Unit::clearActive | ( | ) | [static] |
| void Unit::clearMovePath | ( | ) |
Definition at line 389 of file Unit.cpp.
References _movementPath.
Referenced by moveAlongPath().
Here is the caller graph for this function:

| void Unit::clearSelected | ( | ) | [static] |
| void Unit::computeMovePath | ( | spMapTile | dest | ) |
Definition at line 296 of file Unit.cpp.
References _movementPath, _possibleMoves, _tile, and computeMovePathHelper().
Here is the call graph for this function:

Definition at line 319 of file Unit.cpp.
References _possibleMoves, canMoveInDirection(), and Direction::getAllDirections().
Referenced by computeMovePath().
Here is the call graph for this function:

Here is the caller graph for this function:

Implements GameEntity.
Definition at line 80 of file Unit.cpp.
References _actionPoints, _activeImage, _activeUnit, _image, _selectedImage, _selectedUnit, Display::draw(), Display::getScreenWidth(), Singleton< T >::instance(), Point::x, and Point::y.
Here is the call graph for this function:

| void Unit::drawMovePath | ( | Point | offset | ) | const |
Definition at line 368 of file Unit.cpp.
References _movementPath, _pathEndImage, _pathImage, Singleton< T >::instance(), Point::x, and Point::y.
Here is the call graph for this function:

| const spMapTile Unit::getDestination | ( | ) | const |
Definition at line 394 of file Unit.cpp.
References _movementPath, and hasMovePath().
Here is the call graph for this function:

| map< spMapTile, int > Unit::getPossibleMoves | ( | ) |
| spUnit Unit::getSelectedUnit | ( | ) | [static] |
Definition at line 450 of file Unit.cpp.
References _selectedUnit.
Referenced by MainGameState::processSDLEvent(), and MainGameState::update().
Here is the caller graph for this function:

| int Unit::getX | ( | ) | const |
Definition at line 70 of file Unit.cpp.
References _tile.
Referenced by canMoveInDirection().
Here is the caller graph for this function:

| int Unit::getY | ( | ) | const |
Definition at line 75 of file Unit.cpp.
References _tile.
Referenced by canMoveInDirection().
Here is the caller graph for this function:

| bool Unit::hasMaxActionPoints | ( | ) | const |
| bool Unit::hasMovePath | ( | ) | const |
Definition at line 342 of file Unit.cpp.
References _movementPath.
Referenced by getDestination(), and moveAlongPath().
Here is the caller graph for this function:

| bool Unit::hasTurnBefore | ( | spUnit | u | ) | const |
Definition at line 421 of file Unit.cpp.
References _actionPoints, _maxActionPoints, and _regenRate.
Referenced by MainGameState::endActiveUnitTurn().
Here is the caller graph for this function:

| bool Unit::isPassable | ( | ) | const [virtual] |
| spUnit Unit::makeUnit | ( | int | playerID | ) | [static] |
Definition at line 25 of file Unit.cpp.
Referenced by MainGameState::createUnit().
Here is the caller graph for this function:

| void Unit::markActive | ( | ) |
| void Unit::markSelected | ( | ) |
| void Unit::move | ( | spMapTile | tile | ) |
Definition at line 124 of file Unit.cpp.
References _tile, _weak, and updatePossibleMoves().
Here is the call graph for this function:

| void Unit::move | ( | Direction | dir | ) |
Definition at line 116 of file Unit.cpp.
References _tile, and canMoveInDirection().
Referenced by moveAlongPath().
Here is the call graph for this function:

Here is the caller graph for this function:

| void Unit::moveAlongPath | ( | bool | teleport = false |
) |
Definition at line 347 of file Unit.cpp.
References _actionPoints, _maxActionPoints, _movementPath, clearMovePath(), hasMovePath(), and move().
Here is the call graph for this function:

| void Unit::regenActionPoints | ( | ) |
Definition at line 411 of file Unit.cpp.
References _actionPoints, _maxActionPoints, and _regenRate.
Referenced by MainGameState::endActiveUnitTurn().
Here is the caller graph for this function:

| void Unit::updatePossibleMoves | ( | ) |
Definition at line 251 of file Unit.cpp.
References _actionPoints, _possibleMoves, _tile, canMoveInDirection(), and Direction::getAllDirections().
Referenced by move().
Here is the call graph for this function:

Here is the caller graph for this function:

| void Unit::wait | ( | ) |
int Unit::_actionPoints [private] |
Definition at line 68 of file Unit.h.
Referenced by canMoveInDirection(), draw(), hasMaxActionPoints(), hasTurnBefore(), moveAlongPath(), regenActionPoints(), updatePossibleMoves(), and wait().
SDL_Surface * Unit::_activeImage = NULL [static, private] |
spUnit Unit::_activeUnit [static, private] |
SDL_Surface * Unit::_image = NULL [static, private] |
int Unit::_maxActionPoints = 50 [static, private] |
Definition at line 82 of file Unit.h.
Referenced by hasMaxActionPoints(), hasTurnBefore(), moveAlongPath(), and regenActionPoints().
list<pair<spMapTile, int> > Unit::_movementPath [private] |
Definition at line 67 of file Unit.h.
Referenced by clearMovePath(), computeMovePath(), drawMovePath(), getDestination(), hasMovePath(), and moveAlongPath().
SDL_Surface * Unit::_pathEndImage = NULL [static, private] |
SDL_Surface * Unit::_pathImage = NULL [static, private] |
int Unit::_playerID [private] |
map<spMapTile, int> Unit::_possibleMoves [private] |
Definition at line 66 of file Unit.h.
Referenced by computeMovePath(), computeMovePathHelper(), getPossibleMoves(), and updatePossibleMoves().
int Unit::_regenRate [private] |
SDL_Surface * Unit::_selectedImage = NULL [static, private] |
spUnit Unit::_selectedUnit [static, private] |
Definition at line 74 of file Unit.h.
Referenced by clearSelected(), draw(), getSelectedUnit(), and markSelected().
spMapTile Unit::_tile [private] |
Definition at line 71 of file Unit.h.
Referenced by canMoveInDirection(), computeMovePath(), getX(), getY(), move(), Unit(), and updatePossibleMoves().
wpUnit Unit::_weak [private] |
1.4.7