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

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

Inheritance diagram for GSRoad:

Public Types

enum  ErrorMessages {
  ERR_ROAD_BASE,
  ERR_ROAD_WORKS_IN_PROGRESS,
  ERR_ROAD_DRIVE_THROUGH_WRONG_DIRECTION,
  ERR_ROAD_CANNOT_BUILD_ON_TOWN_ROAD,
  ERR_ROAD_ONE_WAY_ROADS_CANNOT_HAVE_JUNCTIONS
}
 All road related error messages. More...
 
enum  RoadType {
  ROADTYPE_ROAD,
  ROADTYPE_TRAM,
  ROADTYPE_INVALID
}
 Types of road known to the game. More...
 
enum  RoadVehicleType {
  ROADVEHTYPE_BUS,
  ROADVEHTYPE_TRUCK
}
 Type of road station. More...
 
enum  BuildType {
  BT_ROAD,
  BT_DEPOT,
  BT_BUS_STOP,
  BT_TRUCK_STOP
}
 Types of road-related objects in the game. More...
 

Static Public Member Functions

static RoadVehicleType GetRoadVehicleTypeForCargo (CargoID cargo_type)
 Determines whether a busstop or a truckstop is needed to transport a certain cargo. More...
 
static bool IsRoadTile (TileIndex tile)
 Checks whether the given tile is actually a tile with road that can be used to traverse a tile. More...
 
static bool IsRoadDepotTile (TileIndex tile)
 Checks whether the given tile is actually a tile with a road depot. More...
 
static bool IsRoadStationTile (TileIndex tile)
 Checks whether the given tile is actually a tile with a road station. More...
 
static bool IsDriveThroughRoadStationTile (TileIndex tile)
 Checks whether the given tile is actually a tile with a drive through road station. More...
 
static bool IsRoadTypeAvailable (RoadType road_type)
 Check if a given RoadType is available. More...
 
static RoadType GetCurrentRoadType ()
 Get the current RoadType set for all GSRoad functions. More...
 
static void SetCurrentRoadType (RoadType road_type)
 Set the RoadType for all further GSRoad functions. More...
 
static bool HasRoadType (TileIndex tile, RoadType road_type)
 Check if a given tile has RoadType. More...
 
static bool AreRoadTilesConnected (TileIndex tile_from, TileIndex tile_to)
 Checks whether the given tiles are directly connected, i.e. More...
 
static int32 CanBuildConnectedRoadParts (GSTile::Slope slope, struct Array *existing, TileIndex start, TileIndex end)
 Lookup function for building road parts independend on whether the "building on slopes" setting is enabled or not. More...
 
static int32 CanBuildConnectedRoadPartsHere (TileIndex tile, TileIndex start, TileIndex end)
 Lookup function for building road parts independend on whether the "building on slopes" setting is enabled or not. More...
 
static int32 GetNeighbourRoadCount (TileIndex tile)
 Count how many neighbours are road. More...
 
static TileIndex GetRoadDepotFrontTile (TileIndex depot)
 Gets the tile in front of a road depot. More...
 
static TileIndex GetRoadStationFrontTile (TileIndex station)
 Gets the tile in front of a road station. More...
 
static TileIndex GetDriveThroughBackTile (TileIndex station)
 Gets the tile at the back of a drive through road station. More...
 
static bool BuildRoad (TileIndex start, TileIndex end)
 Builds a road from the center of tile start to the center of tile end. More...
 
static bool BuildOneWayRoad (TileIndex start, TileIndex end)
 Builds a one-way road from the center of tile start to the center of tile end. More...
 
static bool BuildRoadFull (TileIndex start, TileIndex end)
 Builds a road from the edge of tile start to the edge of tile end (both included). More...
 
static bool BuildOneWayRoadFull (TileIndex start, TileIndex end)
 Builds a one-way road from the edge of tile start to the edge of tile end (both included). More...
 
static bool BuildRoadDepot (TileIndex tile, TileIndex front)
 Builds a road depot. More...
 
static bool BuildRoadStation (TileIndex tile, TileIndex front, RoadVehicleType road_veh_type, StationID station_id)
 Builds a road bus or truck station. More...
 
static bool BuildDriveThroughRoadStation (TileIndex tile, TileIndex front, RoadVehicleType road_veh_type, StationID station_id)
 Builds a drive-through road bus or truck station. More...
 
static bool RemoveRoad (TileIndex start, TileIndex end)
 Removes a road from the center of tile start to the center of tile end. More...
 
static bool RemoveRoadFull (TileIndex start, TileIndex end)
 Removes a road from the edge of tile start to the edge of tile end (both included). More...
 
static bool RemoveRoadDepot (TileIndex tile)
 Removes a road depot. More...
 
static bool RemoveRoadStation (TileIndex tile)
 Removes a road bus or truck station. More...
 
static Money GetBuildCost (RoadType roadtype, BuildType build_type)
 Get the baseprice of building a road-related object. More...
 
static uint16 GetMaintenanceCostFactor (RoadType roadtype)
 Get the maintenance cost factor of a roadtype. More...
 

Detailed Description

Class that handles all road related functions.

Member Enumeration Documentation

◆ BuildType

Types of road-related objects in the game.

Enumerator
BT_ROAD 

Build a piece of road.

BT_DEPOT 

Build a road depot.

BT_BUS_STOP 

Build a bus stop.

BT_TRUCK_STOP 

Build a truck stop.

◆ ErrorMessages

All road related error messages.

Enumerator
ERR_ROAD_BASE 

Base for road building / maintaining errors.

ERR_ROAD_WORKS_IN_PROGRESS 

Road works are in progress.

ERR_ROAD_DRIVE_THROUGH_WRONG_DIRECTION 

Drive through is in the wrong direction.

ERR_ROAD_CANNOT_BUILD_ON_TOWN_ROAD 

Drive through roads can't be build on town owned roads.

ERR_ROAD_ONE_WAY_ROADS_CANNOT_HAVE_JUNCTIONS 

One way roads can't have junctions.

◆ RoadType

Types of road known to the game.

Enumerator
ROADTYPE_ROAD 

Build road objects.

ROADTYPE_TRAM 

Build tram objects.

ROADTYPE_INVALID 

Invalid RoadType.

◆ RoadVehicleType

Type of road station.

Enumerator
ROADVEHTYPE_BUS 

Build objects useable for busses and passenger trams.

ROADVEHTYPE_TRUCK 

Build objects useable for trucks and cargo trams.

Member Function Documentation

◆ AreRoadTilesConnected()

static bool GSRoad::AreRoadTilesConnected ( TileIndex  tile_from,
TileIndex  tile_to 
)
static

Checks whether the given tiles are directly connected, i.e.

whether a road vehicle can travel from the center of the first tile to the center of the second tile.

Parameters
tile_fromThe source tile.
tile_toThe destination tile.
Precondition
IsRoadTypeAvailable(GetCurrentRoadType()).
GSMap::IsValidTile(tile_from).
GSMap::IsValidTile(tile_to).
'tile_from' and 'tile_to' are directly neighbouring tiles.
Returns
True if and only if a road vehicle can go from tile_from to tile_to.

◆ BuildDriveThroughRoadStation()

static bool GSRoad::BuildDriveThroughRoadStation ( TileIndex  tile,
TileIndex  front,
RoadVehicleType  road_veh_type,
StationID  station_id 
)
static

Builds a drive-through road bus or truck station.

Parameters
tilePlace to build the station.
frontA tile on the same axis with 'tile' as the station shall be oriented.
road_veh_typeWhether to build a truck or bus station.
station_idThe station to join, GSStation::STATION_NEW or GSStation::STATION_JOIN_ADJACENT.
Precondition
GSMap::IsValidTile(tile).
GSMap::IsValidTile(front).
'tile' is not equal to 'front', but in a straight line of it.
station_id == GSStation::STATION_NEW || station_id == GSStation::STATION_JOIN_ADJACENT || GSStation::IsValidStation(station_id).
IsRoadTypeAvailable(GetCurrentRoadType()).
Valid GSCompanyMode active in scope.
Exceptions
GSError::ERR_OWNED_BY_ANOTHER_COMPANY
GSError::ERR_AREA_NOT_CLEAR
GSError::ERR_FLAT_LAND_REQUIRED
GSRoad::ERR_ROAD_DRIVE_THROUGH_WRONG_DIRECTION
GSRoad::ERR_ROAD_CANNOT_BUILD_ON_TOWN_ROAD
GSError::ERR_VEHICLE_IN_THE_WAY
GSStation::ERR_STATION_TOO_CLOSE_TO_ANOTHER_STATION
GSStation::ERR_STATION_TOO_MANY_STATIONS
GSStation::ERR_STATION_TOO_MANY_STATIONS_IN_TOWN
Returns
Whether the station has been/can be build or not.

◆ BuildOneWayRoad()

static bool GSRoad::BuildOneWayRoad ( TileIndex  start,
TileIndex  end 
)
static

Builds a one-way road from the center of tile start to the center of tile end.

If the road already exists, it is made one-way road. If the road already exists and is already one-way in this direction, the road is made two-way again. If the road already exists but is one-way in the other direction, it's made a 'no'-way road (it's forbidden to enter the tile from any direction).

Parameters
startThe start tile of the road.
endThe end tile of the road.
Precondition
'start' is not equal to 'end'.
GSMap::IsValidTile(start).
GSMap::IsValidTile(end).
'start' and 'end' are in a straight line, i.e. GSMap::GetTileX(start) == GSMap::GetTileX(end) or GSMap::GetTileY(start) == GSMap::GetTileY(end).
GetCurrentRoadType() == ROADTYPE_ROAD.
Valid GSCompanyMode active in scope.
Exceptions
GSError::ERR_ALREADY_BUILT
GSError::ERR_LAND_SLOPED_WRONG
GSError::ERR_AREA_NOT_CLEAR
GSRoad::ERR_ROAD_ONE_WAY_ROADS_CANNOT_HAVE_JUNCTIONS
GSRoad::ERR_ROAD_WORKS_IN_PROGRESS
GSError::ERR_VEHICLE_IN_THE_WAY
Note
Construction will fail if an obstacle is found between the start and end tiles.
Returns
Whether the road has been/can be build or not.

◆ BuildOneWayRoadFull()

static bool GSRoad::BuildOneWayRoadFull ( TileIndex  start,
TileIndex  end 
)
static

Builds a one-way road from the edge of tile start to the edge of tile end (both included).

If the road already exists, it is made one-way road. If the road already exists and is already one-way in this direction, the road is made two-way again. If the road already exists but is one-way in the other direction, it's made a 'no'-way road (it's forbidden to enter the tile from any direction).

Parameters
startThe start tile of the road.
startThe start tile of the road.
endThe end tile of the road.
Precondition
'start' is not equal to 'end'.
GSMap::IsValidTile(start).
GSMap::IsValidTile(end).
'start' and 'end' are in a straight line, i.e. GSMap::GetTileX(start) == GSMap::GetTileX(end) or GSMap::GetTileY(start) == GSMap::GetTileY(end).
GetCurrentRoadType() == ROADTYPE_ROAD.
Valid GSCompanyMode active in scope.
Exceptions
GSError::ERR_ALREADY_BUILT
GSError::ERR_LAND_SLOPED_WRONG
GSError::ERR_AREA_NOT_CLEAR
GSRoad::ERR_ROAD_ONE_WAY_ROADS_CANNOT_HAVE_JUNCTIONS
GSRoad::ERR_ROAD_WORKS_IN_PROGRESS
GSError::ERR_VEHICLE_IN_THE_WAY
Note
Construction will fail if an obstacle is found between the start and end tiles.
Returns
Whether the road has been/can be build or not.

◆ BuildRoad()

static bool GSRoad::BuildRoad ( TileIndex  start,
TileIndex  end 
)
static

Builds a road from the center of tile start to the center of tile end.

Parameters
startThe start tile of the road.
endThe end tile of the road.
Precondition
'start' is not equal to 'end'.
GSMap::IsValidTile(start).
GSMap::IsValidTile(end).
'start' and 'end' are in a straight line, i.e. GSMap::GetTileX(start) == GSMap::GetTileX(end) or GSMap::GetTileY(start) == GSMap::GetTileY(end).
IsRoadTypeAvailable(GetCurrentRoadType()).
Exceptions
GSError::ERR_ALREADY_BUILT
GSError::ERR_LAND_SLOPED_WRONG
GSError::ERR_AREA_NOT_CLEAR
GSRoad::ERR_ROAD_ONE_WAY_ROADS_CANNOT_HAVE_JUNCTIONS
GSRoad::ERR_ROAD_WORKS_IN_PROGRESS
GSError::ERR_VEHICLE_IN_THE_WAY
Note
Construction will fail if an obstacle is found between the start and end tiles.
Building a piece of road (without CompanyMode) results in a piece of road owned by towns.
Returns
Whether the road has been/can be build or not.

◆ BuildRoadDepot()

static bool GSRoad::BuildRoadDepot ( TileIndex  tile,
TileIndex  front 
)
static

Builds a road depot.

Parameters
tilePlace to build the depot.
frontThe tile exactly in front of the depot.
Precondition
GSMap::IsValidTile(tile).
GSMap::IsValidTile(front).
'tile' is not equal to 'front', but in a straight line of it.
IsRoadTypeAvailable(GetCurrentRoadType()).
Valid GSCompanyMode active in scope.
Exceptions
GSError::ERR_FLAT_LAND_REQUIRED
GSError::ERR_AREA_NOT_CLEAR
Returns
Whether the road depot has been/can be build or not.

◆ BuildRoadFull()

static bool GSRoad::BuildRoadFull ( TileIndex  start,
TileIndex  end 
)
static

Builds a road from the edge of tile start to the edge of tile end (both included).

Parameters
startThe start tile of the road.
endThe end tile of the road.
Precondition
'start' is not equal to 'end'.
GSMap::IsValidTile(start).
GSMap::IsValidTile(end).
'start' and 'end' are in a straight line, i.e. GSMap::GetTileX(start) == GSMap::GetTileX(end) or GSMap::GetTileY(start) == GSMap::GetTileY(end).
IsRoadTypeAvailable(GetCurrentRoadType()).
Exceptions
GSError::ERR_ALREADY_BUILT
GSError::ERR_LAND_SLOPED_WRONG
GSError::ERR_AREA_NOT_CLEAR
GSRoad::ERR_ROAD_ONE_WAY_ROADS_CANNOT_HAVE_JUNCTIONS
GSRoad::ERR_ROAD_WORKS_IN_PROGRESS
GSError::ERR_VEHICLE_IN_THE_WAY
Note
Construction will fail if an obstacle is found between the start and end tiles.
Building a piece of road (without CompanyMode) results in a piece of road owned by towns.
Returns
Whether the road has been/can be build or not.

◆ BuildRoadStation()

static bool GSRoad::BuildRoadStation ( TileIndex  tile,
TileIndex  front,
RoadVehicleType  road_veh_type,
StationID  station_id 
)
static

Builds a road bus or truck station.

Parameters
tilePlace to build the station.
frontThe tile exactly in front of the station.
road_veh_typeWhether to build a truck or bus station.
station_idThe station to join, GSStation::STATION_NEW or GSStation::STATION_JOIN_ADJACENT.
Precondition
GSMap::IsValidTile(tile).
GSMap::IsValidTile(front).
'tile' is not equal to 'front', but in a straight line of it.
station_id == GSStation::STATION_NEW || station_id == GSStation::STATION_JOIN_ADJACENT || GSStation::IsValidStation(station_id).
GetCurrentRoadType() == ROADTYPE_ROAD.
Valid GSCompanyMode active in scope.
Exceptions
GSError::ERR_OWNED_BY_ANOTHER_COMPANY
GSError::ERR_AREA_NOT_CLEAR
GSError::ERR_FLAT_LAND_REQUIRED
GSRoad::ERR_ROAD_DRIVE_THROUGH_WRONG_DIRECTION
GSRoad::ERR_ROAD_CANNOT_BUILD_ON_TOWN_ROAD
GSError::ERR_VEHICLE_IN_THE_WAY
GSStation::ERR_STATION_TOO_CLOSE_TO_ANOTHER_STATION
GSStation::ERR_STATION_TOO_MANY_STATIONS
GSStation::ERR_STATION_TOO_MANY_STATIONS_IN_TOWN
Returns
Whether the station has been/can be build or not.

◆ CanBuildConnectedRoadParts()

static int32 GSRoad::CanBuildConnectedRoadParts ( GSTile::Slope  slope,
struct Array *  existing,
TileIndex  start,
TileIndex  end 
)
static

Lookup function for building road parts independend on whether the "building on slopes" setting is enabled or not.

This implementation can be used for abstract reasoning about a tile as it needs the slope and existing road parts of the tile as information.

Parameters
slopeThe slope of the tile to examine.
existingAn array with the existing neighbours in the same format as "start" and "end", e.g. GSMap.GetTileIndex(0, 1). As a result of this all values of the existing array must be of type integer.
startThe tile from where the 'tile to be considered' will be entered. This is a relative tile, so valid parameters are: GSMap.GetTileIndex(0, 1), GSMap.GetTileIndex(0, -1), GSMap.GetTileIndex(1, 0) and GSMap.GetTileIndex(-1, 0).
endThe tile from where the 'tile to be considered' will be exited. This is a relative tile, sovalid parameters are: GSMap.GetTileIndex(0, 1), GSMap.GetTileIndex(0, -1), GSMap.GetTileIndex(1, 0) and GSMap.GetTileIndex(-1, 0).
Precondition
start != end.
slope must be a valid slope, i.e. one specified in GSTile::Slope.
Note
Passing data that would be invalid in-game, e.g. existing containing road parts that can not be build on a tile with the given slope, does not necessarily means that -1 is returned, i.e. not all preconditions written here or assumed by the game are extensively checked to make sure the data entered is valid.
Returns
0 when the build parts do not connect, 1 when they do connect once they are build or 2 when building the first part automatically builds the second part. -1 means the preconditions are not met.

◆ CanBuildConnectedRoadPartsHere()

static int32 GSRoad::CanBuildConnectedRoadPartsHere ( TileIndex  tile,
TileIndex  start,
TileIndex  end 
)
static

Lookup function for building road parts independend on whether the "building on slopes" setting is enabled or not.

This implementation can be used for reasoning about an existing tile.

Parameters
tileThe the tile to examine.
startThe tile from where "tile" will be entered.
endThe tile from where "tile" will be exited.
Precondition
start != end.
tile != start.
tile != end.
GSMap.IsValidTile(tile).
GSMap.IsValidTile(start).
GSMap.IsValidTile(end).
GSMap.GetDistanceManhattanToTile(tile, start) == 1.
GSMap.GetDistanceManhattanToTile(tile, end) == 1.
Returns
0 when the build parts do not connect, 1 when they do connect once they are build or 2 when building the first part automatically builds the second part. -1 means the preconditions are not met.

◆ GetBuildCost()

static Money GSRoad::GetBuildCost ( RoadType  roadtype,
BuildType  build_type 
)
static

Get the baseprice of building a road-related object.

Parameters
roadtypethe roadtype that is build (on)
build_typethe type of object to build
Precondition
IsRoadTypeAvailable(railtype)
Returns
The baseprice of building the given object.

◆ GetCurrentRoadType()

static RoadType GSRoad::GetCurrentRoadType ( )
static

Get the current RoadType set for all GSRoad functions.

Returns
The RoadType currently set.

◆ GetDriveThroughBackTile()

static TileIndex GSRoad::GetDriveThroughBackTile ( TileIndex  station)
static

Gets the tile at the back of a drive through road station.

So, one side of the drive through station is retrieved with GetTileInFrontOfStation, the other with this function.

Parameters
stationThe road station tile.
Precondition
IsDriveThroughRoadStationTile(station).
Returns
The tile at the back of the drive through road station.

◆ GetMaintenanceCostFactor()

static uint16 GSRoad::GetMaintenanceCostFactor ( RoadType  roadtype)
static

Get the maintenance cost factor of a roadtype.

Parameters
roadtypeThe roadtype to get the maintenance factor of.
Precondition
IsRoadTypeAvailable(roadtype)
Returns
Maintenance cost factor of the roadtype.

◆ GetNeighbourRoadCount()

static int32 GSRoad::GetNeighbourRoadCount ( TileIndex  tile)
static

Count how many neighbours are road.

Parameters
tileThe tile to check on.
Precondition
GSMap::IsValidTile(tile).
IsRoadTypeAvailable(GetCurrentRoadType()).
Returns
0 means no neighbour road; max value is 4.

◆ GetRoadDepotFrontTile()

static TileIndex GSRoad::GetRoadDepotFrontTile ( TileIndex  depot)
static

Gets the tile in front of a road depot.

Parameters
depotThe road depot tile.
Precondition
IsRoadDepotTile(depot).
Returns
The tile in front of the depot.

◆ GetRoadStationFrontTile()

static TileIndex GSRoad::GetRoadStationFrontTile ( TileIndex  station)
static

Gets the tile in front of a road station.

Parameters
stationThe road station tile.
Precondition
IsRoadStationTile(station).
Returns
The tile in front of the road station.

◆ GetRoadVehicleTypeForCargo()

static RoadVehicleType GSRoad::GetRoadVehicleTypeForCargo ( CargoID  cargo_type)
static

Determines whether a busstop or a truckstop is needed to transport a certain cargo.

Parameters
cargo_typeThe cargo to test.
Precondition
GSCargo::IsValidCargo(cargo_type).
Returns
The road vehicle type needed to transport the cargo.

◆ HasRoadType()

static bool GSRoad::HasRoadType ( TileIndex  tile,
RoadType  road_type 
)
static

Check if a given tile has RoadType.

Parameters
tileThe tile to check.
road_typeThe RoadType to check for.
Precondition
GSMap::IsValidTile(tile).
IsRoadTypeAvailable(road_type).
Returns
True if the tile contains a RoadType object.

◆ IsDriveThroughRoadStationTile()

static bool GSRoad::IsDriveThroughRoadStationTile ( TileIndex  tile)
static

Checks whether the given tile is actually a tile with a drive through road station.

Parameters
tileThe tile to check.
Precondition
GSMap::IsValidTile(tile).
IsRoadTypeAvailable(GetCurrentRoadType()).
Returns
True if and only if the tile has a drive through road station.

◆ IsRoadDepotTile()

static bool GSRoad::IsRoadDepotTile ( TileIndex  tile)
static

Checks whether the given tile is actually a tile with a road depot.

Parameters
tileThe tile to check.
Precondition
GSMap::IsValidTile(tile).
IsRoadTypeAvailable(GetCurrentRoadType()).
Returns
True if and only if the tile has a road depot.

◆ IsRoadStationTile()

static bool GSRoad::IsRoadStationTile ( TileIndex  tile)
static

Checks whether the given tile is actually a tile with a road station.

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

◆ IsRoadTile()

static bool GSRoad::IsRoadTile ( TileIndex  tile)
static

Checks whether the given tile is actually a tile with road that can be used to traverse a tile.

This excludes road depots and 'normal' road stations, but includes drive through stations.

Parameters
tileThe tile to check.
Precondition
GSMap::IsValidTile(tile).
Returns
True if and only if the tile has road.

◆ IsRoadTypeAvailable()

static bool GSRoad::IsRoadTypeAvailable ( RoadType  road_type)
static

Check if a given RoadType is available.

Parameters
road_typeThe RoadType to check for.
Precondition
Valid GSCompanyMode active in scope.
Returns
True if this RoadType can be used.

◆ RemoveRoad()

static bool GSRoad::RemoveRoad ( TileIndex  start,
TileIndex  end 
)
static

Removes a road from the center of tile start to the center of tile end.

Parameters
startThe start tile of the road.
endThe end tile of the road.
Precondition
'start' is not equal to 'end'.
GSMap::IsValidTile(start).
GSMap::IsValidTile(end).
'start' and 'end' are in a straight line, i.e. GSMap::GetTileX(start) == GSMap::GetTileX(end) or GSMap::GetTileY(start) == GSMap::GetTileY(end).
IsRoadTypeAvailable(GetCurrentRoadType()).
Valid GSCompanyMode active in scope.
Exceptions
GSError::ERR_OWNED_BY_ANOTHER_COMPANY
GSError::ERR_VEHICLE_IN_THE_WAY
GSRoad::ERR_ROAD_WORKS_IN_PROGRESS
Returns
Whether the road has been/can be removed or not.

◆ RemoveRoadDepot()

static bool GSRoad::RemoveRoadDepot ( TileIndex  tile)
static

Removes a road depot.

Parameters
tilePlace to remove the depot from.
Precondition
GSMap::IsValidTile(tile).
Tile is a road depot.
Valid GSCompanyMode active in scope.
Exceptions
GSError::ERR_OWNED_BY_ANOTHER_COMPANY
GSError::ERR_VEHICLE_IN_THE_WAY
Returns
Whether the road depot has been/can be removed or not.

◆ RemoveRoadFull()

static bool GSRoad::RemoveRoadFull ( TileIndex  start,
TileIndex  end 
)
static

Removes a road from the edge of tile start to the edge of tile end (both included).

Parameters
startThe start tile of the road.
endThe end tile of the road.
Precondition
'start' is not equal to 'end'.
GSMap::IsValidTile(start).
GSMap::IsValidTile(end).
'start' and 'end' are in a straight line, i.e. GSMap::GetTileX(start) == GSMap::GetTileX(end) or GSMap::GetTileY(start) == GSMap::GetTileY(end).
IsRoadTypeAvailable(GetCurrentRoadType()).
Valid GSCompanyMode active in scope.
Exceptions
GSError::ERR_OWNED_BY_ANOTHER_COMPANY
GSError::ERR_VEHICLE_IN_THE_WAY
GSRoad::ERR_ROAD_WORKS_IN_PROGRESS
Returns
Whether the road has been/can be removed or not.

◆ RemoveRoadStation()

static bool GSRoad::RemoveRoadStation ( TileIndex  tile)
static

Removes a road bus or truck station.

Parameters
tilePlace to remove the station from.
Precondition
GSMap::IsValidTile(tile).
Tile is a road station.
Valid GSCompanyMode active in scope.
Exceptions
GSError::ERR_OWNED_BY_ANOTHER_COMPANY
GSError::ERR_VEHICLE_IN_THE_WAY
Returns
Whether the station has been/can be removed or not.

◆ SetCurrentRoadType()

static void GSRoad::SetCurrentRoadType ( RoadType  road_type)
static

Set the RoadType for all further GSRoad functions.

Parameters
road_typeThe RoadType to set.