OpenTTD Game API
Public Types | Static Public Member Functions
GSTile Class Reference

Class that handles all tile related functions. More...

Inheritance diagram for GSTile:

Public Types

enum  ErrorMessages {
  ERR_TILE_BASE,
  ERR_TILE_TOO_HIGH,
  ERR_TILE_TOO_LOW,
  ERR_AREA_ALREADY_FLAT,
  ERR_EXCAVATION_WOULD_DAMAGE
}
 Error messages related to modifying tiles. More...
 
enum  Corner {
  CORNER_W,
  CORNER_S,
  CORNER_E,
  CORNER_N,
  CORNER_INVALID
}
 Enumeration for corners of tiles. More...
 
enum  Slope {
  SLOPE_FLAT,
  SLOPE_W,
  SLOPE_S,
  SLOPE_E,
  SLOPE_N,
  SLOPE_STEEP,
  SLOPE_NW,
  SLOPE_SW,
  SLOPE_SE,
  SLOPE_NE,
  SLOPE_EW,
  SLOPE_NS,
  SLOPE_ELEVATED,
  SLOPE_NWS,
  SLOPE_WSE,
  SLOPE_SEN,
  SLOPE_ENW,
  SLOPE_STEEP_W,
  SLOPE_STEEP_S,
  SLOPE_STEEP_E,
  SLOPE_STEEP_N,
  SLOPE_INVALID
}
 Enumeration for the slope-type. More...
 
enum  TransportType {
  TRANSPORT_RAIL,
  TRANSPORT_ROAD,
  TRANSPORT_WATER,
  TRANSPORT_AIR,
  TRANSPORT_INVALID
}
 The different transport types a tile can have. More...
 
enum  BuildType {
  BT_FOUNDATION,
  BT_TERRAFORM,
  BT_BUILD_TREES,
  BT_CLEAR_GRASS,
  BT_CLEAR_ROUGH,
  BT_CLEAR_ROCKY,
  BT_CLEAR_FIELDS,
  BT_CLEAR_HOUSE
}
 Get the base cost for building/clearing several things. More...
 
enum  TerrainType {
  TERRAIN_NORMAL,
  TERRAIN_DESERT,
  TERRAIN_RAINFOREST,
  TERRAIN_SNOW
}
 The types of terrain a tile can have. More...
 

Static Public Member Functions

static bool IsBuildable (TileIndex tile)
 Check if this tile is buildable, i.e. More...
 
static bool IsBuildableRectangle (TileIndex tile, uint width, uint 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 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 int32 GetMinHeight (TileIndex tile)
 Get the minimal height on a tile. More...
 
static int32 GetMaxHeight (TileIndex tile)
 Get the maximal height on a tile. More...
 
static int32 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 int32 GetCargoAcceptance (TileIndex tile, CargoID cargo_type, int width, int height, int radius)
 Check how much cargo this tile accepts. More...
 
static int32 GetCargoProduction (TileIndex tile, CargoID cargo_type, int width, int height, int radius)
 Checks how many producers in the radius produces this cargo. More...
 
static int32 GetDistanceManhattanToTile (TileIndex tile_from, TileIndex tile_to)
 Get the manhattan distance from the tile to the tile. More...
 
static int32 GetDistanceSquareToTile (TileIndex tile_from, TileIndex tile_to)
 Get the square distance from the tile to the tile. More...
 
static bool RaiseTile (TileIndex tile, int32 slope)
 Raise the given corners of the tile. More...
 
static bool LowerTile (TileIndex tile, int32 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, uint width, uint 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...
 

Detailed Description

Class that handles all tile related functions.

Member Enumeration Documentation

◆ BuildType

Get the base cost for building/clearing several things.

Enumerator
BT_FOUNDATION 

Build a foundation under something.

BT_TERRAFORM 

Terraform.

BT_BUILD_TREES 

Build trees.

BT_CLEAR_GRASS 

Clear a tile with just grass.

BT_CLEAR_ROUGH 

Clear a rough tile.

BT_CLEAR_ROCKY 

Clear a tile with rocks.

BT_CLEAR_FIELDS 

Clear a tile with farm fields.

BT_CLEAR_HOUSE 

Clear a tile with a house.

◆ Corner

Enumeration for corners of tiles.

Enumerator
CORNER_W 

West corner.

CORNER_S 

South corner.

CORNER_E 

East corner.

CORNER_N 

North corner.

CORNER_INVALID 

An invalid corner.

◆ ErrorMessages

Error messages related to modifying tiles.

Enumerator
ERR_TILE_BASE 

Base for tile related errors.

ERR_TILE_TOO_HIGH 

Tile can't be raised any higher.

ERR_TILE_TOO_LOW 

Tile can't be lowered any lower.

ERR_AREA_ALREADY_FLAT 

The area was already flat.

ERR_EXCAVATION_WOULD_DAMAGE 

There is a tunnel underneed.

◆ 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.

Enumerator
SLOPE_FLAT 

A flat tile.

SLOPE_W 

The west corner of the tile is raised.

SLOPE_S 

The south corner of the tile is raised.

SLOPE_E 

The east corner of the tile is raised.

SLOPE_N 

The north corner of the tile is raised.

SLOPE_STEEP 

Indicates the slope is steep (The corner opposite of the not-raised corner is raised two times)

SLOPE_NW 

North and west corner are raised.

SLOPE_SW 

South and west corner are raised.

SLOPE_SE 

South and east corner are raised.

SLOPE_NE 

North and east corner are raised.

SLOPE_EW 

East and west corner are raised.

SLOPE_NS 

North and south corner are raised.

SLOPE_ELEVATED 

Bit mask containing all 'simple' slopes. Does not appear as a slope.

SLOPE_NWS 

North, west and south corner are raised.

SLOPE_WSE 

West, south and east corner are raised.

SLOPE_SEN 

South, east and north corner are raised.

SLOPE_ENW 

East, north and west corner are raised.

SLOPE_STEEP_W 

A steep slope falling to east (from west)

SLOPE_STEEP_S 

A steep slope falling to north (from south)

SLOPE_STEEP_E 

A steep slope falling to west (from east)

SLOPE_STEEP_N 

A steep slope falling to south (from north)

SLOPE_INVALID 

An invalid slope.

◆ TerrainType

The types of terrain a tile can have.

Note
When a desert or rainforest tile are changed, their terrain type will remain the same. In other words, a sea tile can be of the desert terrain type.
The snow terrain type can change to the normal terrain type and vice versa based on landscaping or variable snow lines from NewGRFs.
Enumerator
TERRAIN_NORMAL 

A normal tile (default); not desert, rainforest or snow.

TERRAIN_DESERT 

A tile in the desert (manually set in in scenarios, below certain height and certain distance from water in random games).

TERRAIN_RAINFOREST 

A tile in the rainforest (manually set in scenarios, certain distance away from deserts in random games),.

TERRAIN_SNOW 

A tile on or above the snowline level.

◆ TransportType

The different transport types a tile can have.

Enumerator
TRANSPORT_RAIL 

Tile with rail.

TRANSPORT_ROAD 

Tile with road.

TRANSPORT_WATER 

Tile with navigable waterways.

TRANSPORT_AIR 

Tile with airport.

TRANSPORT_INVALID 

Tile without any transport type.

Member Function Documentation

◆ DemolishTile()

static bool GSTile::DemolishTile ( TileIndex  tile)
static

Destroy everything on the given tile.

Parameters
tileThe tile to demolish.
Precondition
GSMap::IsValidTile(tile).
Valid GSCompanyMode active in scope.
Exceptions
GSError::ERR_AREA_NOT_CLEAR
Returns
True if and only if the tile was demolished.

◆ GetBuildCost()

static Money GSTile::GetBuildCost ( BuildType  build_type)
static

Get the baseprice of building/clearing various tile-related things.

Parameters
build_typethe type to build
Returns
The baseprice of building or removing the given object.

◆ GetCargoAcceptance()

static int32 GSTile::GetCargoAcceptance ( TileIndex  tile,
CargoID  cargo_type,
int  width,
int  height,
int  radius 
)
static

Check how much cargo this tile accepts.

It creates a radius around the tile, and adds up all acceptance of this cargo.

Parameters
tileThe tile to check on.
cargo_typeThe cargo to check the acceptance of.
widthThe width of the station.
heightThe height of the station.
radiusThe radius of the station.
Precondition
GSMap::IsValidTile(tile).
GSCargo::IsValidCargo(cargo_type)
width > 0.
height > 0.
radius >= 0.
Returns
Value below 8 means no acceptance; the more the better.

◆ GetCargoProduction()

static int32 GSTile::GetCargoProduction ( TileIndex  tile,
CargoID  cargo_type,
int  width,
int  height,
int  radius 
)
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.

Parameters
tileThe tile to check on.
cargo_typeThe cargo to check the production of.
widthThe width of the station.
heightThe height of the station.
radiusThe radius of the station.
Precondition
GSMap::IsValidTile(tile).
GSCargo::IsValidCargo(cargo_type)
width > 0.
height > 0.
radius >= 0.
Returns
The number of producers that produce this cargo within radius of the tile.

◆ GetClosestTown()

static TownID GSTile::GetClosestTown ( TileIndex  tile)
static

Find the town that is closest to a tile.

Stations you build at this tile will belong to this town.

Parameters
tileThe tile to check.
Returns
The TownID of the town closest to the tile.

◆ GetComplementSlope()

static Slope GSTile::GetComplementSlope ( Slope  slope)
static

Get the complement of the slope.

Parameters
slopeThe slope to get the complement of.
Precondition
slope != SLOPE_INVALID.
!IsSteepSlope(slope).
!IsHalftileSlope(slope).
Returns
The complement of a slope. This means that all corners that weren't raised, are raised, and visa versa.

◆ GetCornerHeight()

static int32 GSTile::GetCornerHeight ( TileIndex  tile,
Corner  corner 
)
static

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.

Parameters
tileThe tile to check on.
cornerThe corner to query.
Precondition
GSMap::IsValidTile(tile).
Returns
The height of the lowest corner of the tile, ranging from 0 to 15.

◆ GetDistanceManhattanToTile()

static int32 GSTile::GetDistanceManhattanToTile ( TileIndex  tile_from,
TileIndex  tile_to 
)
static

Get the manhattan distance from the tile to the tile.

Parameters
tile_fromThe tile to get the distance to.
tile_toThe tile to get the distance to.
Returns
The distance between the two tiles.

◆ GetDistanceSquareToTile()

static int32 GSTile::GetDistanceSquareToTile ( TileIndex  tile_from,
TileIndex  tile_to 
)
static

Get the square distance from the tile to the tile.

Parameters
tile_fromThe tile to get the distance to.
tile_toThe tile to get the distance to.
Returns
The distance between the two tiles.

◆ GetMaxHeight()

static int32 GSTile::GetMaxHeight ( TileIndex  tile)
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.

Parameters
tileThe tile to check on.
Precondition
GSMap::IsValidTile(tile).
Returns
The height of the highest corner of the tile, ranging from 0 to 15.

◆ GetMinHeight()

static int32 GSTile::GetMinHeight ( TileIndex  tile)
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.

Parameters
tileThe tile to check on.
Precondition
GSMap::IsValidTile(tile).
Returns
The height of the lowest corner of the tile, ranging from 0 to 15.

◆ GetOwner()

static GSCompany::CompanyID GSTile::GetOwner ( TileIndex  tile)
static

Get the owner of the tile.

Parameters
tileThe tile to get the owner from.
Precondition
GSMap::IsValidTile(tile).
Returns
The CompanyID of the owner of the tile, or COMPANY_INVALID if there is no owner (grass/industry/water tiles, etc.).

◆ GetSlope()

static Slope GSTile::GetSlope ( TileIndex  tile)
static

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.

Parameters
tileThe tile to check on.
Precondition
GSMap::IsValidTile(tile).
Returns
Bit mask encoding the slope. See Slope for a description of the returned values.

◆ GetTerrainType()

static TerrainType GSTile::GetTerrainType ( TileIndex  tile)
static

Get the type of terrain regardless of buildings or infrastructure.

Note
When a desert or rainforest tile are changed, their terrain type will remain the same. In other words, a sea tile can be of the desert terrain type.
The snow terrain type can change to the normal terrain type and vice versa based on landscaping or variable snow lines from NewGRFs.
Parameters
tileThe tile to check on.
Precondition
GSMap::IsValidTile(tile).
Returns
The TerrainType.

◆ GetTownAuthority()

static TownID GSTile::GetTownAuthority ( TileIndex  tile)
static

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.

Parameters
tileThe tile to check.
Returns
The TownID of the town which has authority on this tile.

◆ HasTransportType()

static bool GSTile::HasTransportType ( TileIndex  tile,
TransportType  transport_type 
)
static

Checks whether the given tile contains parts suitable for the given TransportType.

Parameters
tileThe tile to check.
transport_typeThe TransportType to check against.
Precondition
GSMap::IsValidTile(tile).
transport_type != TRANSPORT_AIR.
Note
Returns false on tiles with roadworks and on road tiles with only a single piece of road as these tiles cannot be used to transport anything on. It furthermore returns true on some coast tile for TRANSPORT_WATER because ships can navigate over them.
Use GSAirport.IsAirportTile to check for airport tiles. Aircraft can fly over every tile on the map so using HasTransportType doesn't make sense for TRANSPORT_AIR.
Returns
True if and only if the tile has the given TransportType.

◆ HasTreeOnTile()

static bool GSTile::HasTreeOnTile ( TileIndex  tile)
static

Check if the tile has any tree on it.

Parameters
tileThe tile to check on.
Precondition
GSMap::IsValidTile(tile).
Returns
True if and only if there is a tree on the tile.

◆ IsBuildable()

static bool GSTile::IsBuildable ( TileIndex  tile)
static

Check if this tile is buildable, i.e.

no things on it that needs demolishing.

Parameters
tileThe tile to check on.
Precondition
GSMap::IsValidTile(tile).
Returns
True if it is buildable, false if not.
Note
For trams you also might want to check for GSRoad::IsRoad(), as you can build tram-rails on road-tiles.
For rail you also might want to check for GSRoad::IsRoad(), as in some cases you can build rails on road-tiles.

◆ IsBuildableRectangle()

static bool GSTile::IsBuildableRectangle ( TileIndex  tile,
uint  width,
uint  height 
)
static

Check if this tile is buildable in a rectangle around a tile, with the entry in the list as top-left.

Parameters
tileThe tile to check on.
widthThe width of the rectangle.
heightThe height of the rectangle.
Precondition
GSMap::IsValidTile(tile).
Returns
True if it is buildable, false if not.

◆ IsCoastTile()

static bool GSTile::IsCoastTile ( TileIndex  tile)
static

Checks whether the given tile is actually a coast tile.

Parameters
tileThe tile to check.
Precondition
GSMap::IsValidTile(tile).
Returns
True if and only if the tile is a coast tile.
Note
Building on coast tiles in general is more expensive. This is not true if there are also trees on the tile, see HasTreeOnTile.

◆ IsDesertTile()

static bool GSTile::IsDesertTile ( TileIndex  tile)
static

Check if the tile without buildings or infrastructure is a desert tile.

Note
If you want to know if a tile (with or without buildings and infrastructure) is in a desert, use GSTile::GetTerrainType(tile).
Parameters
tileThe tile to check on.
Precondition
GSMap::IsValidTile(tile).
Returns
True if and only if the tile is desert tile.

◆ IsFarmTile()

static bool GSTile::IsFarmTile ( TileIndex  tile)
static

Check if the tile is a farmland tile.

Parameters
tileThe tile to check on.
Precondition
GSMap::IsValidTile(tile).
Returns
True if and only if the tile is farmland.

◆ IsHalftileSlope()

static bool GSTile::IsHalftileSlope ( Slope  slope)
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.

Parameters
slopeThe slope to check on.
Precondition
slope != SLOPE_INVALID.
Returns
True if the slope is a halftile slope.
Note
Currently there is no API function that would return or accept a halftile slope.

◆ IsRockTile()

static bool GSTile::IsRockTile ( TileIndex  tile)
static

Check if the tile is a rock tile.

Parameters
tileThe tile to check on.
Precondition
GSMap::IsValidTile(tile).
Returns
True if and only if the tile is rock tile.

◆ IsRoughTile()

static bool GSTile::IsRoughTile ( TileIndex  tile)
static

Check if the tile is a rough tile.

Parameters
tileThe tile to check on.
Precondition
GSMap::IsValidTile(tile).
Returns
True if and only if the tile is rough tile.

◆ IsSnowTile()

static bool GSTile::IsSnowTile ( TileIndex  tile)
static

Check if the tile without buildings or infrastructure is a snow tile.

Note
If you want to know if a tile (with or without buildings and infrastructure) is on or above the snowline, use GSTile::GetTerrainType(tile).
Parameters
tileThe tile to check on.
Precondition
GSMap::IsValidTile(tile).
Returns
True if and only if the tile is snow tile.

◆ IsStationTile()

static bool GSTile::IsStationTile ( TileIndex  tile)
static

Checks whether the given tile is a station tile of any station.

Parameters
tileThe tile to check.
Precondition
GSMap::IsValidTile(tile).
Returns
True if and only if the tile is a station tile.

◆ IsSteepSlope()

static bool GSTile::IsSteepSlope ( Slope  slope)
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.

Parameters
slopeThe slope to check on.
Precondition
slope != SLOPE_INVALID.
Returns
True if the slope is a steep slope.

◆ IsWaterTile()

static bool GSTile::IsWaterTile ( TileIndex  tile)
static

Checks whether the given tile is actually a water tile.

Parameters
tileThe tile to check on.
Precondition
GSMap::IsValidTile(tile).
Returns
True if and only if the tile is a water tile.

◆ IsWithinTownInfluence()

static bool GSTile::IsWithinTownInfluence ( TileIndex  tile,
TownID  town_id 
)
static

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.

Parameters
tileThe tile to check.
town_idThe town to check.
Returns
True if the tile is within the rating influence of the town.

◆ LevelTiles()

static bool GSTile::LevelTiles ( TileIndex  start_tile,
TileIndex  end_tile 
)
static

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).

Parameters
start_tileOne corner of the rectangle to level.
end_tileThe opposite corner of the rectangle.
Precondition
start_tile < GSMap::GetMapSize().
end_tile < GSMap::GetMapSize().
Valid GSCompanyMode active in scope.
Exceptions
GSError::ERR_AREA_NOT_CLEAR
GSError::ERR_TOO_CLOSE_TO_EDGE
Returns
True if one or more tiles were leveled.
Note
Even if leveling some part fails, some other part may have been successfully leveled already.
This function may return true in GSTestMode, although it fails in GSExecMode.

◆ LowerTile()

static bool GSTile::LowerTile ( TileIndex  tile,
int32  slope 
)
static

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.

Note
The corners will be modified in the order west (first), south, east, north (last). Changing one corner might cause another corner to be changed too. So modifiing multiple corners may result in changing some corners by multiple steps.
Parameters
tileThe tile to lower.
slopeCorners to lower (SLOPE_xxx).
Precondition
tile < GSMap::GetMapSize().
Valid GSCompanyMode active in scope.
Exceptions
GSError::ERR_AREA_NOT_CLEAR
GSError::ERR_TOO_CLOSE_TO_EDGE
GSTile::ERR_TILE_TOO_LOW
Returns
0 means failed, 1 means success.

◆ PlantTree()

static bool GSTile::PlantTree ( TileIndex  tile)
static

Create a random tree on a tile.

Parameters
tileThe tile to build a tree on.
Precondition
GSMap::IsValidTile(tile).
Valid GSCompanyMode active in scope.
Returns
True if and only if a tree was added on the tile.

◆ PlantTreeRectangle()

static bool GSTile::PlantTreeRectangle ( TileIndex  tile,
uint  width,
uint  height 
)
static

Create a random tree on a rectangle of tiles.

Parameters
tileThe top left tile of the rectangle.
widthThe width of the rectangle.
heightThe height of the rectangle.
Precondition
GSMap::IsValidTile(tile).
width >= 1 && width <= 20.
height >= 1 && height <= 20.
Valid GSCompanyMode active in scope.
Returns
True if and only if a tree was added on any of the tiles in the rectangle.

◆ RaiseTile()

static bool GSTile::RaiseTile ( TileIndex  tile,
int32  slope 
)
static

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.

Note
The corners will be modified in the order west (first), south, east, north (last). Changing one corner might cause another corner to be changed too. So modifiing multiple corners may result in changing some corners by multiple steps.
Parameters
tileThe tile to raise.
slopeCorners to raise (SLOPE_xxx).
Precondition
tile < GSMap::GetMapSize().
Valid GSCompanyMode active in scope.
Exceptions
GSError::ERR_AREA_NOT_CLEAR
GSError::ERR_TOO_CLOSE_TO_EDGE
GSTile::ERR_TILE_TOO_HIGH
Returns
0 means failed, 1 means success.