OpenTTD GameScript API
20240906-master-gd5ff6b4156
|
Class that handles all tile related functions. More...
Static Public Member Functions | |
static bool | IsBuildable (TileIndex tile) |
Check if this tile is buildable, i.e. More... | |
static bool | IsBuildableRectangle (TileIndex tile, int width, int height) |
Check if this tile is buildable in a rectangle around a tile, with the entry in the list as top-left. More... | |
static bool | IsSeaTile (TileIndex tile) |
Checks whether the given tile is actually a sea tile. More... | |
static bool | IsRiverTile (TileIndex tile) |
Checks whether the given tile is actually a river tile. More... | |
static bool | IsWaterTile (TileIndex tile) |
Checks whether the given tile is actually a water tile. More... | |
static bool | IsCoastTile (TileIndex tile) |
Checks whether the given tile is actually a coast tile. More... | |
static bool | IsStationTile (TileIndex tile) |
Checks whether the given tile is a station tile of any station. More... | |
static bool | IsSteepSlope (Slope slope) |
Check if a tile has a steep slope. More... | |
static bool | IsHalftileSlope (Slope slope) |
Check if a tile has a halftile slope. More... | |
static bool | HasTreeOnTile (TileIndex tile) |
Check if the tile has any tree on it. More... | |
static bool | IsFarmTile (TileIndex tile) |
Check if the tile is a farmland tile. More... | |
static bool | IsRockTile (TileIndex tile) |
Check if the tile is a rock tile. More... | |
static bool | IsRoughTile (TileIndex tile) |
Check if the tile is a rough tile. More... | |
static bool | IsSnowTile (TileIndex tile) |
Check if the tile without buildings or infrastructure is a snow tile. More... | |
static bool | IsDesertTile (TileIndex tile) |
Check if the tile without buildings or infrastructure is a desert tile. More... | |
static TerrainType | GetTerrainType (TileIndex tile) |
Get the type of terrain regardless of buildings or infrastructure. More... | |
static Slope | GetSlope (TileIndex tile) |
Get the slope of a tile. More... | |
static Slope | GetComplementSlope (Slope slope) |
Get the complement of the slope. More... | |
static int | GetMinHeight (TileIndex tile) |
Get the minimal height on a tile. More... | |
static int | GetMaxHeight (TileIndex tile) |
Get the maximal height on a tile. More... | |
static int | GetCornerHeight (TileIndex tile, Corner corner) |
Get the height of a certain corner of a tile. More... | |
static GSCompany::CompanyID | GetOwner (TileIndex tile) |
Get the owner of the tile. More... | |
static bool | HasTransportType (TileIndex tile, TransportType transport_type) |
Checks whether the given tile contains parts suitable for the given TransportType. More... | |
static int | GetCargoAcceptance (TileIndex tile, CargoID cargo_type, int width, int height, int radius) |
Check how much cargo this tile accepts. More... | |
static int | GetCargoProduction (TileIndex tile, CargoID cargo_type, int width, int height, int radius) |
Checks how many producers in the radius produces this cargo. More... | |
static int | GetDistanceManhattanToTile (TileIndex tile_from, TileIndex tile_to) |
Get the manhattan distance from the tile to the tile. More... | |
static int | GetDistanceSquareToTile (TileIndex tile_from, TileIndex tile_to) |
Get the square distance from the tile to the tile. More... | |
static bool | RaiseTile (TileIndex tile, Slope slope) |
Raise the given corners of the tile. More... | |
static bool | LowerTile (TileIndex tile, Slope slope) |
Lower the given corners of the tile. More... | |
static bool | LevelTiles (TileIndex start_tile, TileIndex end_tile) |
Level all tiles in the rectangle between start_tile and end_tile so they are at the same height. More... | |
static bool | DemolishTile (TileIndex tile) |
Destroy everything on the given tile. More... | |
static bool | PlantTree (TileIndex tile) |
Create a random tree on a tile. More... | |
static bool | PlantTreeRectangle (TileIndex tile, int width, int height) |
Create a random tree on a rectangle of tiles. More... | |
static bool | IsWithinTownInfluence (TileIndex tile, TownID town_id) |
Find out if this tile is within the rating influence of a town. More... | |
static TownID | GetTownAuthority (TileIndex tile) |
Find the town which has authority for the tile. More... | |
static TownID | GetClosestTown (TileIndex tile) |
Find the town that is closest to a tile. More... | |
static Money | GetBuildCost (BuildType build_type) |
Get the baseprice of building/clearing various tile-related things. More... | |
Class that handles all tile related functions.
enum GSTile::BuildType |
Get the base cost for building/clearing several things.
enum GSTile::Corner |
Error messages related to modifying tiles.
enum GSTile::Slope |
Enumeration for the slope-type.
This enumeration use the chars N, E, S, W corresponding the direction North, East, South and West. The top corner of a tile is the north-part of the tile.
enum GSTile::TerrainType |
The types of terrain a tile can have.
|
static |
Destroy everything on the given tile.
tile | The tile to demolish. |
GSError::ERR_AREA_NOT_CLEAR |
Get the baseprice of building/clearing various tile-related things.
build_type | the type to build |
|
static |
Check how much cargo this tile accepts.
It creates a radius around the tile, and adds up all acceptance of this cargo.
tile | The tile to check on. |
cargo_type | The cargo to check the acceptance of. |
width | The width of the station. |
height | The height of the station. |
radius | The radius of the station. |
|
static |
Checks how many producers in the radius produces this cargo.
It creates a radius around the tile, and counts all producer of this cargo.
tile | The tile to check on. |
cargo_type | The cargo to check the production of. |
width | The width of the station. |
height | The height of the station. |
radius | The radius of the station. |
Find the town that is closest to a tile.
Stations you build at this tile will belong to this town.
tile | The tile to check. |
Get the complement of the slope.
slope | The slope to get the complement of. |
Get the height of a certain corner of a tile.
The returned height is the height of the bare tile. A possible foundation on the tile does not influence this height.
tile | The tile to check on. |
corner | The corner to query. |
Get the manhattan distance from the tile to the tile.
tile_from | The tile to get the distance to. |
tile_to | The tile to get the distance to. |
Get the square distance from the tile to the tile.
tile_from | The tile to get the distance to. |
tile_to | The tile to get the distance to. |
|
static |
Get the maximal height on a tile.
The returned height is the height of the bare tile. A possible foundation on the tile does not influence this height.
tile | The tile to check on. |
|
static |
Get the minimal height on a tile.
The returned height is the height of the bare tile. A possible foundation on the tile does not influence this height.
tile | The tile to check on. |
|
static |
Get the owner of the tile.
tile | The tile to get the owner from. |
Get the slope of a tile.
This is the slope of the bare tile. A possible foundation on the tile does not influence this slope.
tile | The tile to check on. |
|
static |
Get the type of terrain regardless of buildings or infrastructure.
tile | The tile to check on. |
Find the town which has authority for the tile.
The rating of your company in this town will be checked and affected when building stations, trees etc.
tile | The tile to check. |
|
static |
Checks whether the given tile contains parts suitable for the given TransportType.
tile | The tile to check. |
transport_type | The TransportType to check against. |
|
static |
Check if the tile has any tree on it.
tile | The tile to check on. |
|
static |
Check if this tile is buildable, i.e.
no things on it that needs demolishing.
tile | The tile to check on. |
|
static |
Check if this tile is buildable in a rectangle around a tile, with the entry in the list as top-left.
tile | The tile to check on. |
width | The width of the rectangle. |
height | The height of the rectangle. |
|
static |
Checks whether the given tile is actually a coast tile.
tile | The tile to check. |
|
static |
Check if the tile without buildings or infrastructure is a desert tile.
tile | The tile to check on. |
|
static |
Check if the tile is a farmland tile.
tile | The tile to check on. |
|
static |
Check if a tile has a halftile slope.
Halftile slopes appear on top of halftile foundations. E.g. the slope you get when building a horizontal railtrack on the top of a SLOPE_N or SLOPE_STEEP_N.
slope | The slope to check on. |
|
static |
Checks whether the given tile is actually a river tile.
tile | The tile to check on. |
|
static |
Check if the tile is a rock tile.
tile | The tile to check on. |
|
static |
Check if the tile is a rough tile.
tile | The tile to check on. |
|
static |
Checks whether the given tile is actually a sea tile.
tile | The tile to check on. |
|
static |
Check if the tile without buildings or infrastructure is a snow tile.
tile | The tile to check on. |
|
static |
Checks whether the given tile is a station tile of any station.
tile | The tile to check. |
|
static |
Check if a tile has a steep slope.
Steep slopes are slopes with a height difference of 2 across one diagonal of the tile.
slope | The slope to check on. |
|
static |
Checks whether the given tile is actually a water tile.
tile | The tile to check on. |
Find out if this tile is within the rating influence of a town.
If a station sign would be on this tile, the servicing quality of the station would influence the rating of the town.
tile | The tile to check. |
town_id | The town to check. |
Level all tiles in the rectangle between start_tile and end_tile so they are at the same height.
All tiles will be raised or lowered until they are at height GSTile::GetCornerHeight(start_tile, GSTile::CORNER_N).
start_tile | One corner of the rectangle to level. |
end_tile | The opposite corner of the rectangle. |
Lower the given corners of the tile.
The corners can be combined, for example: SLOPE_N | SLOPE_W (= SLOPE_NW) will lower the west and the north corner.
tile | The tile to lower. |
slope | Corners to lower (SLOPE_xxx). |
|
static |
Create a random tree on a tile.
tile | The tile to build a tree on. |
|
static |
Create a random tree on a rectangle of tiles.
tile | The top left tile of the rectangle. |
width | The width of the rectangle. |
height | The height of the rectangle. |
Raise the given corners of the tile.
The corners can be combined, for example: SLOPE_N | SLOPE_W (= SLOPE_NW) will raise the west and the north corner.
tile | The tile to raise. |
slope | Corners to raise (SLOPE_xxx). |