#include <position.h>
Public Member Functions | |
| Position () | |
| Position (int x, int y) | |
| Position (const Position &pos) | |
| Position (const Position &pos, Direction2 dir) | |
| Position (const Position &pos, int dx, int dy) | |
| Position & | operator= (const Position &pos) |
| bool | move (Direction2 dir) |
| bool | testBounds () |
Public Attributes | |
| int | posX |
| Horizontal coordinate of the position. | |
| int | posY |
| Vertical coordnate of the position. | |
Definition at line 140 of file position.h.
| Position::Position | ( | ) |
| Position::Position | ( | int | x, | |
| int | y | |||
| ) |
Construct a position at a given x and y coordinate.
| x | X coordinate of the new position. | |
| y | Y coordinate of the new position. |
Definition at line 85 of file position.cpp.
| Position::Position | ( | const Position & | pos | ) |
| Position::Position | ( | const Position & | pos, | |
| Direction2 | dir | |||
| ) |
| Position::Position | ( | const Position & | pos, | |
| int | dx, | |||
| int | dy | |||
| ) |
Copy sonstructor with arbitrary movement.
| pos | Position to copy. | |
| dx | Horizontal offset. | |
| dy | Vertical offset. |
Definition at line 119 of file position.cpp.
| bool Position::move | ( | Direction2 | dir | ) |
Move the position one step in the indicated direction.
| dir | Direction to move into. |
Definition at line 144 of file position.cpp.
References DIR2_EAST, DIR2_INVALID, DIR2_NORTH, DIR2_NORTH_EAST, DIR2_NORTH_WEST, DIR2_SOUTH, DIR2_SOUTH_EAST, DIR2_SOUTH_WEST, DIR2_WEST, NOT_REACHED, posX, posY, WORLD_H, and WORLD_W.
Referenced by Micropolis::doBRiver(), Micropolis::doPowerScan(), Micropolis::doSRiver(), Position(), Micropolis::testForConductive(), Micropolis::treeSplash(), and Micropolis::tryDrive().
| bool Position::testBounds | ( | ) | [inline] |
Test whether the position is on-map.
Definition at line 163 of file position.h.
References posX, posY, WORLD_H, and WORLD_W.
Referenced by Micropolis::addToTrafficDensityMap(), and Micropolis::treeSplash().
1.5.6