Micropolis
|
Defines position handling and direction enumeration for the Micropolis game engine. More...
Go to the source code of this file.
Classes | |
class | Position |
Enumerations | |
enum | Direction2 { DIR2_INVALID , DIR2_NORTH , DIR2_NORTH_EAST , DIR2_EAST , DIR2_SOUTH_EAST , DIR2_SOUTH , DIR2_SOUTH_WEST , DIR2_WEST , DIR2_NORTH_WEST , DIR2_BEGIN = DIR2_NORTH , DIR2_END = DIR2_NORTH_WEST + 1 } |
Functions | |
static Direction2 | increment45 (Direction2 dir, int count=1) |
static Direction2 | increment90 (Direction2 dir) |
static Direction2 | rotate45 (Direction2 dir, int count=1) |
static Direction2 | rotate90 (Direction2 dir) |
static Direction2 | rotate180 (Direction2 dir) |
bool | operator< (const Position &pos1, const Position &pos2) |
Defines position handling and direction enumeration for the Micropolis game engine.
This header file provides classes and functions for handling positions and directions within the Micropolis game world. It includes the 'Position' class for representing X/Y coordinates and 'Direction2' enumeration for defining 8 cardinal directions. Functions for manipulating and querying these positions and directions are also provided, which are essential for navigating and interacting with the game world's grid.
Definition in file position.h.
enum Direction2 |
Another direction enumeration class, with 8 possible directions.
Eliminate #Direction.
After eliminating #Direction, rename this enum to Direction.
Definition at line 86 of file position.h.
|
inlinestatic |
Increment the direction by 45 degrees.
dir | Direction to rotate. |
Definition at line 106 of file position.h.
Referenced by increment90().
|
inlinestatic |
Increment the direction by 90 degrees.
dir | Direction to rotate. |
Definition at line 117 of file position.h.
References increment45().
Referenced by Micropolis::doPowerScan().
Less-than comparison on positions (needed for map since Position is used as key value).
pos1 | First position. |
pos2 | Second position. |
Definition at line 190 of file position.h.
References Position::posX, and Position::posY.
|
inlinestatic |
Rotate the direction by 180 degrees.
dir | Direction to rotate. |
Definition at line 147 of file position.h.
References rotate45().
Referenced by Micropolis::doRivers(), and Micropolis::tryDrive().
|
inlinestatic |
Increment the direction by 45 degrees.
dir | Direction to rotate. |
Definition at line 127 of file position.h.
References DIR2_NORTH.
Referenced by Micropolis::doBRiver(), Micropolis::doSRiver(), rotate180(), and rotate90().
|
inlinestatic |
Rotate the direction by 90 degrees.
dir | Direction to rotate. |
Definition at line 137 of file position.h.
References rotate45().
Referenced by Micropolis::tryGo().