Public Types | |
enum | ErrorMessages { ERR_ROAD_BASE = AIError::ERR_CAT_ROAD << AIError::ERR_CAT_BIT_SIZE, 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 = 0, ROADTYPE_TRAM = 1, ROADTYPE_INVALID = -1 } |
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. | |
static bool | IsRoadTile (TileIndex tile) |
Checks whether the given tile is actually a tile with road that can be used to traverse a tile. | |
static bool | IsRoadDepotTile (TileIndex tile) |
Checks whether the given tile is actually a tile with a road depot. | |
static bool | IsRoadStationTile (TileIndex tile) |
Checks whether the given tile is actually a tile with a road station. | |
static bool | IsDriveThroughRoadStationTile (TileIndex tile) |
Checks whether the given tile is actually a tile with a drive through road station. | |
static bool | IsRoadTypeAvailable (RoadType road_type) |
Check if a given RoadType is available. | |
static RoadType | GetCurrentRoadType () |
Get the current RoadType set for all AIRoad functions. | |
static void | SetCurrentRoadType (RoadType road_type) |
Set the RoadType for all further AIRoad functions. | |
static bool | HasRoadType (TileIndex tile, RoadType road_type) |
Check if a given tile has RoadType. | |
static bool | AreRoadTilesConnected (TileIndex tile_from, TileIndex tile_to) |
Checks whether the given tiles are directly connected, i.e. | |
static int32 | CanBuildConnectedRoadParts (AITile::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. | |
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. | |
static int32 | GetNeighbourRoadCount (TileIndex tile) |
Count how many neighbours are road. | |
static TileIndex | GetRoadDepotFrontTile (TileIndex depot) |
Gets the tile in front of a road depot. | |
static TileIndex | GetRoadStationFrontTile (TileIndex station) |
Gets the tile in front of a road station. | |
static TileIndex | GetDriveThroughBackTile (TileIndex station) |
Gets the tile at the back of a drive through road station. | |
static bool | BuildRoad (TileIndex start, TileIndex end) |
Builds a road from the center of tile start to the center of tile end. | |
static bool | BuildOneWayRoad (TileIndex start, TileIndex end) |
Builds a one-way road from the center of tile start to the center of tile end. | |
static bool | BuildRoadFull (TileIndex start, TileIndex end) |
Builds a road from the edge of tile start to the edge of tile end (both included). | |
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). | |
static bool | BuildRoadDepot (TileIndex tile, TileIndex front) |
Builds a road depot. | |
static bool | BuildRoadStation (TileIndex tile, TileIndex front, RoadVehicleType road_veh_type, StationID station_id) |
Builds a road bus or truck station. | |
static bool | BuildDriveThroughRoadStation (TileIndex tile, TileIndex front, RoadVehicleType road_veh_type, StationID station_id) |
Builds a drive-through road bus or truck station. | |
static bool | RemoveRoad (TileIndex start, TileIndex end) |
Removes a road from the center of tile start to the center of tile end. | |
static bool | RemoveRoadFull (TileIndex start, TileIndex end) |
Removes a road from the edge of tile start to the edge of tile end (both included). | |
static bool | RemoveRoadDepot (TileIndex tile) |
Removes a road depot. | |
static bool | RemoveRoadStation (TileIndex tile) |
Removes a road bus or truck station. | |
static Money | GetBuildCost (RoadType roadtype, BuildType build_type) |
Get the baseprice of building a road-related object. |
All road related error messages.
enum AIRoad::RoadType |
enum AIRoad::BuildType |
static RoadVehicleType AIRoad::GetRoadVehicleTypeForCargo | ( | CargoID | cargo_type | ) | [static] |
Determines whether a busstop or a truckstop is needed to transport a certain cargo.
cargo_type | The cargo to test. |
static bool AIRoad::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.
tile | The tile to check. |
static bool AIRoad::IsRoadDepotTile | ( | TileIndex | tile | ) | [static] |
Checks whether the given tile is actually a tile with a road depot.
tile | The tile to check. |
static bool AIRoad::IsRoadStationTile | ( | TileIndex | tile | ) | [static] |
Checks whether the given tile is actually a tile with a road station.
tile | The tile to check. |
static bool AIRoad::IsDriveThroughRoadStationTile | ( | TileIndex | tile | ) | [static] |
Checks whether the given tile is actually a tile with a drive through road station.
tile | The tile to check. |
static bool AIRoad::IsRoadTypeAvailable | ( | RoadType | road_type | ) | [static] |
Check if a given RoadType is available.
road_type | The RoadType to check for. |
static RoadType AIRoad::GetCurrentRoadType | ( | ) | [static] |
static void AIRoad::SetCurrentRoadType | ( | RoadType | road_type | ) | [static] |
Check if a given tile has RoadType.
tile | The tile to check. | |
road_type | The RoadType to check for. |
IsRoadTypeAvailable(road_type).
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.
tile_from | The source tile. | |
tile_to | The destination tile. |
AIMap::IsValidTile(tile_from).
AIMap::IsValidTile(tile_to).
'tile_from' and 'tile_to' are directly neighbouring tiles.
static int32 AIRoad::CanBuildConnectedRoadParts | ( | AITile::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.
slope | The slope of the tile to examine. | |
existing | An array with the existing neighbours in the same format as "start" and "end", e.g. AIMap.GetTileIndex(0, 1). As a result of this all values of the existing array must be of type integer. | |
start | The tile from where the 'tile to be considered' will be entered. This is a relative tile, so valid parameters are: AIMap.GetTileIndex(0, 1), AIMap.GetTileIndex(0, -1), AIMap.GetTileIndex(1, 0) and AIMap.GetTileIndex(-1, 0). | |
end | The tile from where the 'tile to be considered' will be exited. This is a relative tile, sovalid parameters are: AIMap.GetTileIndex(0, 1), AIMap.GetTileIndex(0, -1), AIMap.GetTileIndex(1, 0) and AIMap.GetTileIndex(-1, 0). |
slope must be a valid slope, i.e. one specified in AITile::Slope.
static int32 AIRoad::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.
tile | The the tile to examine. | |
start | The tile from where "tile" will be entered. | |
end | The tile from where "tile" will be exited. |
tile != start.
tile != end.
AIMap.IsValidTile(tile).
AIMap.IsValidTile(start).
AIMap.IsValidTile(end).
AIMap.GetDistanceManhattanToTile(tile, start) == 1.
AIMap.GetDistanceManhattanToTile(tile, end) == 1.
static int32 AIRoad::GetNeighbourRoadCount | ( | TileIndex | tile | ) | [static] |
Count how many neighbours are road.
tile | The tile to check on. |
IsRoadTypeAvailable(GetCurrentRoadType()).
Gets the tile in front of a road depot.
depot | The road depot tile. |
Gets the tile in front of a road station.
station | The road station tile. |
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.
station | The road station tile. |
Builds a road from the center of tile start to the center of tile end.
start | The start tile of the road. | |
end | The end tile of the road. |
AIMap::IsValidTile(start).
AIMap::IsValidTile(end).
'start' and 'end' are in a straight line, i.e. AIMap::GetTileX(start) == AIMap::GetTileX(end) or AIMap::GetTileY(start) == AIMap::GetTileY(end).
IsRoadTypeAvailable(GetCurrentRoadType()).
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).
start | The start tile of the road. | |
end | The end tile of the road. |
AIMap::IsValidTile(start).
AIMap::IsValidTile(end).
'start' and 'end' are in a straight line, i.e. AIMap::GetTileX(start) == AIMap::GetTileX(end) or AIMap::GetTileY(start) == AIMap::GetTileY(end).
GetCurrentRoadType() == ROADTYPE_ROAD.
Builds a road from the edge of tile start to the edge of tile end (both included).
start | The start tile of the road. | |
end | The end tile of the road. |
AIMap::IsValidTile(start).
AIMap::IsValidTile(end).
'start' and 'end' are in a straight line, i.e. AIMap::GetTileX(start) == AIMap::GetTileX(end) or AIMap::GetTileY(start) == AIMap::GetTileY(end).
IsRoadTypeAvailable(GetCurrentRoadType()).
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).
start | The start tile of the road. | |
start | The start tile of the road. | |
end | The end tile of the road. |
AIMap::IsValidTile(start).
AIMap::IsValidTile(end).
'start' and 'end' are in a straight line, i.e. AIMap::GetTileX(start) == AIMap::GetTileX(end) or AIMap::GetTileY(start) == AIMap::GetTileY(end).
GetCurrentRoadType() == ROADTYPE_ROAD.
Builds a road depot.
tile | Place to build the depot. | |
front | The tile exactly in front of the depot. |
AIMap::IsValidTile(front).
'tile' is not equal to 'front', but in a straight line of it.
IsRoadTypeAvailable(GetCurrentRoadType()).
static bool AIRoad::BuildRoadStation | ( | TileIndex | tile, | |
TileIndex | front, | |||
RoadVehicleType | road_veh_type, | |||
StationID | station_id | |||
) | [static] |
Builds a road bus or truck station.
tile | Place to build the station. | |
front | The tile exactly in front of the station. | |
road_veh_type | Whether to build a truck or bus station. | |
station_id | The station to join, AIStation::STATION_NEW or AIStation::STATION_JOIN_ADJACENT. |
AIMap::IsValidTile(front).
'tile' is not equal to 'front', but in a straight line of it.
station_id == AIStation::STATION_NEW || station_id == AIStation::STATION_JOIN_ADJACENT || AIStation::IsValidStation(station_id).
GetCurrentRoadType() == ROADTYPE_ROAD.
static bool AIRoad::BuildDriveThroughRoadStation | ( | TileIndex | tile, | |
TileIndex | front, | |||
RoadVehicleType | road_veh_type, | |||
StationID | station_id | |||
) | [static] |
Builds a drive-through road bus or truck station.
tile | Place to build the station. | |
front | A tile on the same axis with 'tile' as the station shall be oriented. | |
road_veh_type | Whether to build a truck or bus station. | |
station_id | The station to join, AIStation::STATION_NEW or AIStation::STATION_JOIN_ADJACENT. |
AIMap::IsValidTile(front).
'tile' is not equal to 'front', but in a straight line of it.
station_id == AIStation::STATION_NEW || station_id == AIStation::STATION_JOIN_ADJACENT || AIStation::IsValidStation(station_id).
IsRoadTypeAvailable(GetCurrentRoadType()).
Removes a road from the center of tile start to the center of tile end.
start | The start tile of the road. | |
end | The end tile of the road. |
AIMap::IsValidTile(end).
'start' and 'end' are in a straight line, i.e. AIMap::GetTileX(start) == AIMap::GetTileX(end) or AIMap::GetTileY(start) == AIMap::GetTileY(end).
IsRoadTypeAvailable(GetCurrentRoadType()).
AIError::ERR_OWNED_BY_ANOTHER_COMPANY | ||
AIError::ERR_VEHICLE_IN_THE_WAY | ||
AIRoad::ERR_ROAD_WORKS_IN_PROGRESS |
Removes a road from the edge of tile start to the edge of tile end (both included).
start | The start tile of the road. | |
end | The end tile of the road. |
AIMap::IsValidTile(end).
'start' and 'end' are in a straight line, i.e. AIMap::GetTileX(start) == AIMap::GetTileX(end) or AIMap::GetTileY(start) == AIMap::GetTileY(end).
IsRoadTypeAvailable(GetCurrentRoadType()).
AIError::ERR_OWNED_BY_ANOTHER_COMPANY | ||
AIError::ERR_VEHICLE_IN_THE_WAY | ||
AIRoad::ERR_ROAD_WORKS_IN_PROGRESS |
static bool AIRoad::RemoveRoadDepot | ( | TileIndex | tile | ) | [static] |
Removes a road depot.
tile | Place to remove the depot from. |
Tile is a road depot.
static bool AIRoad::RemoveRoadStation | ( | TileIndex | tile | ) | [static] |
Removes a road bus or truck station.
tile | Place to remove the station from. |
Tile is a road station.
Get the baseprice of building a road-related object.
roadtype | the roadtype that is build (on) | |
build_type | the type of object to build |