OpenTTD AI API
20241117-master-ga6c526cfa0
|
Class that handles all map related functions. More...
Static Public Member Functions | |
static bool | IsValidTile (TileIndex tile) |
Checks whether the given tile is valid. More... | |
static int | GetMapSize () |
Gets the number of tiles in the map. More... | |
static int | GetMapSizeX () |
Gets the amount of tiles along the SW and NE border. More... | |
static int | GetMapSizeY () |
Gets the amount of tiles along the SE and NW border. More... | |
static int | GetTileX (TileIndex tile) |
Gets the place along the SW/NE border (X-value). More... | |
static int | GetTileY (TileIndex tile) |
Gets the place along the SE/NW border (Y-value). More... | |
static TileIndex | GetTileIndex (int x, int y) |
Gets the TileIndex given a x,y-coordinate. More... | |
static int | DistanceManhattan (TileIndex tile_from, TileIndex tile_to) |
Calculates the Manhattan distance; the difference of the X and Y added together. More... | |
static int | DistanceMax (TileIndex tile_from, TileIndex tile_to) |
Calculates the distance between two tiles via 1D calculation. More... | |
static int | DistanceSquare (TileIndex tile_from, TileIndex tile_to) |
The squared distance between the two tiles. More... | |
static int | DistanceFromEdge (TileIndex tile) |
Calculates the shortest distance to the edge. More... | |
Static Public Attributes | |
static const int | TILE_INVALID = INVALID_TILE.base() |
Invalid TileIndex. | |
Class that handles all map related functions.
|
static |
Calculates the shortest distance to the edge.
tile | From where the distance has to be calculated. |
Calculates the Manhattan distance; the difference of the X and Y added together.
tile_from | The start tile. |
tile_to | The destination tile. |
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.
tile_from | The start tile. |
tile_to | The destination tile. |
The squared distance between the two tiles.
This is the distance is the length of the shortest straight line between both points.
tile_from | The start tile. |
tile_to | The destination tile. |
|
static |
Gets the number of tiles in the map.
|
static |
Gets the amount of tiles along the SW and NE border.
|
static |
Gets the amount of tiles along the SE and NW border.
|
static |
Gets the TileIndex given a x,y-coordinate.
x | The X coordinate. |
y | The Y coordinate. |
|
static |
Gets the place along the SW/NE border (X-value).
tile | The tile to get the X-value of. |
|
static |
Gets the place along the SE/NW border (Y-value).
tile | The tile to get the Y-value of. |
|
static |
Checks whether the given tile is valid.
tile | The tile to check. |