|
@@ -46,22 +46,22 @@ public:
|
|
|
* Gets the place along the SW/NE border (X-value).
|
|
|
* @param tile The tile to get the X-value of.
|
|
|
* @pre IsValidTile(tile).
|
|
|
* @return The X-value.
|
|
|
* @post Return value is always lower than GetMapSizeX().
|
|
|
*/
|
|
|
static uint32 GetTileX(TileIndex tile);
|
|
|
static int32 GetTileX(TileIndex tile);
|
|
|
|
|
|
/**
|
|
|
* Gets the place along the SE/NW border (Y-value).
|
|
|
* @param tile The tile to get the Y-value of.
|
|
|
* @pre IsValidTile(tile).
|
|
|
* @return The Y-value.
|
|
|
* @post Return value is always lower than GetMapSizeY().
|
|
|
*/
|
|
|
static uint32 GetTileY(TileIndex tile);
|
|
|
static int32 GetTileY(TileIndex tile);
|
|
|
|
|
|
/**
|
|
|
* Gets the TileIndex given a x,y-coordinate.
|
|
|
* @param x The X coordinate.
|
|
|
* @param y The Y coordinate.
|
|
|
* @pre x < GetMapSizeX().
|
|
@@ -76,42 +76,42 @@ public:
|
|
|
* @param tile_from The start tile.
|
|
|
* @param tile_to The destination tile.
|
|
|
* @pre IsValidTile(tile_from).
|
|
|
* @pre IsValidTile(tile_to).
|
|
|
* @return The Manhattan distance between the tiles.
|
|
|
*/
|
|
|
static uint32 DistanceManhattan(TileIndex tile_from, TileIndex tile_to);
|
|
|
static int32 DistanceManhattan(TileIndex tile_from, TileIndex tile_to);
|
|
|
|
|
|
/**
|
|
|
* Calculates the distance between two tiles via 1D calculation.
|
|
|
* This means the distance between X or the distance between Y, depending
|
|
|
* on which one is bigger.
|
|
|
* @param tile_from The start tile.
|
|
|
* @param tile_to The destination tile.
|
|
|
* @pre IsValidTile(tile_from).
|
|
|
* @pre IsValidTile(tile_to).
|
|
|
* @return The maximum distance between the tiles.
|
|
|
*/
|
|
|
static uint32 DistanceMax(TileIndex tile_from, TileIndex tile_to);
|
|
|
static int32 DistanceMax(TileIndex tile_from, TileIndex tile_to);
|
|
|
|
|
|
/**
|
|
|
* The squared distance between the two tiles.
|
|
|
* This is the distance is the length of the shortest straight line
|
|
|
* between both points.
|
|
|
* @param tile_from The start tile.
|
|
|
* @param tile_to The destination tile.
|
|
|
* @pre IsValidTile(tile_from).
|
|
|
* @pre IsValidTile(tile_to).
|
|
|
* @return The squared distance between the tiles.
|
|
|
*/
|
|
|
static uint32 DistanceSquare(TileIndex tile_from, TileIndex tile_to);
|
|
|
static int32 DistanceSquare(TileIndex tile_from, TileIndex tile_to);
|
|
|
|
|
|
/**
|
|
|
* Calculates the shortest distance to the edge.
|
|
|
* @param tile From where the distance has to be calculated.
|
|
|
* @pre IsValidTile(tile).
|
|
|
* @return The distances to the closest edge.
|
|
|
*/
|
|
|
static uint32 DistanceFromEdge(TileIndex tile);
|
|
|
static int32 DistanceFromEdge(TileIndex tile);
|
|
|
};
|
|
|
|
|
|
#endif /* AI_MAP_HPP */
|