OpenTTD AI API
20241117-master-ga6c526cfa0
|
Class that handles all town related functions. More...
Static Public Member Functions | |
static int | GetTownCount () |
Gets the number of towns. More... | |
static bool | IsValidTown (TownID town_id) |
Checks whether the given town index is valid. More... | |
static string | GetName (TownID town_id) |
Get the name of the town. More... | |
static int | GetPopulation (TownID town_id) |
Gets the number of inhabitants in the town. More... | |
static int | GetHouseCount (TownID town_id) |
Gets the number of houses in the town. More... | |
static TileIndex | GetLocation (TownID town_id) |
Gets the location of the town. More... | |
static int | GetLastMonthProduction (TownID town_id, CargoID cargo_id) |
Get the total last economy-month's production of the given cargo at a town. More... | |
static int | GetLastMonthSupplied (TownID town_id, CargoID cargo_id) |
Get the total amount of cargo supplied from a town last economy-month. More... | |
static int | GetLastMonthTransportedPercentage (TownID town_id, CargoID cargo_id) |
Get the percentage of transported production of the given cargo at a town last economy-month. More... | |
static int | GetLastMonthReceived (TownID town_id, AICargo::TownEffect towneffect_id) |
Get the total amount of cargo effects received by a town last economy-month. More... | |
static int | GetCargoGoal (TownID town_id, AICargo::TownEffect towneffect_id) |
Get the amount of cargo per economy-month that needs to be delivered (per TownEffect) for a town to grow. More... | |
static int | GetGrowthRate (TownID town_id) |
Get the amount of economy-days between town growth. More... | |
static int | GetDistanceManhattanToTile (TownID town_id, TileIndex tile) |
Get the manhattan distance from the tile to the AITown::GetLocation() of the town. More... | |
static int | GetDistanceSquareToTile (TownID town_id, TileIndex tile) |
Get the square distance from the tile to the AITown::GetLocation() of the town. More... | |
static bool | IsWithinTownInfluence (TownID town_id, TileIndex tile) |
Find out if this tile is within the rating influence of a town. More... | |
static bool | HasStatue (TownID town_id) |
Find out if this town has a statue for the current company. More... | |
static bool | IsCity (TownID town_id) |
Find out if the town is a city. More... | |
static int | GetRoadReworkDuration (TownID town_id) |
Find out how long the town is undergoing road reconstructions. More... | |
static int | GetFundBuildingsDuration (TownID town_id) |
Find out how long new buildings are still being funded in a town. More... | |
static AICompany::CompanyID | GetExclusiveRightsCompany (TownID town_id) |
Find out which company currently has the exclusive rights of this town. More... | |
static int | GetExclusiveRightsDuration (TownID town_id) |
Find out how long the town is under influence of the exclusive rights. More... | |
static bool | IsActionAvailable (TownID town_id, TownAction town_action) |
Find out if an action can currently be performed on the town. More... | |
static bool | PerformTownAction (TownID town_id, TownAction town_action) |
Perform a town action on this town. More... | |
static bool | FoundTown (TileIndex tile, TownSize size, bool city, RoadLayout layout, Text *name) |
Found a new town. More... | |
static TownRating | GetRating (TownID town_id, AICompany::CompanyID company_id) |
Get the rating of a company within a town. More... | |
static int | GetAllowedNoise (TownID town_id) |
Get the maximum level of noise that still can be added by airports before the town start to refuse building a new airport. More... | |
static RoadLayout | GetRoadLayout (TownID town_id) |
Get the road layout for a town. More... | |
Class that handles all town related functions.
enum AITown::RoadLayout |
Possible layouts for the roads in a town.
enum AITown::TownAction |
Actions that one can perform on a town.
Enumerator | |
---|---|
TOWN_ACTION_ADVERTISE_SMALL | The cargo ratings temporary gains 25% of rating (in absolute percentage, so 10% becomes 35%, with a max of 99%) for all stations within 10 tiles. |
TOWN_ACTION_ADVERTISE_MEDIUM | The cargo ratings temporary gains 44% of rating (in absolute percentage, so 10% becomes 54%, with a max of 99%) for all stations within 15 tiles. |
TOWN_ACTION_ADVERTISE_LARGE | The cargo ratings temporary gains 63% of rating (in absolute percentage, so 10% becomes 73%, with a max of 99%) for all stations within 20 tiles. |
TOWN_ACTION_ROAD_REBUILD | Rebuild the roads of this town for 6 economy-months.
|
TOWN_ACTION_BUILD_STATUE | Build a statue in this town. |
TOWN_ACTION_FUND_BUILDINGS | Fund the creation of extra buildings for 3 economy-months.
|
TOWN_ACTION_BUY_RIGHTS | Buy exclusive rights for this town for 12 economy-months.
|
TOWN_ACTION_BRIBE | Bribe the town in order to get a higher rating. |
enum AITown::TownGrowth |
enum AITown::TownRating |
Different ratings one could have in a town.
enum AITown::TownSize |
|
static |
Found a new town.
tile | The location of the new town. |
size | The town size of the new town. |
city | True if the new town should be a city. |
layout | The town layout of the new town. |
name | The name of the new town. Pass null, or an empty string, to use a random town name. |
|
static |
Get the maximum level of noise that still can be added by airports before the town start to refuse building a new airport.
town_id | The town to get the allowed noise from. |
|
static |
Get the amount of cargo per economy-month that needs to be delivered (per TownEffect) for a town to grow.
All goals need to be reached before a town will grow.
town_id | The index of the town. |
towneffect_id | The index of the towneffect. |
Get the manhattan distance from the tile to the AITown::GetLocation() of the town.
town_id | The town to get the distance to. |
tile | The tile to get the distance to. |
Get the square distance from the tile to the AITown::GetLocation() of the town.
town_id | The town to get the distance to. |
tile | The tile to get the distance to. |
|
static |
Find out which company currently has the exclusive rights of this town.
town_id | The town to check. |
|
static |
Find out how long the town is under influence of the exclusive rights.
town_id | The town to check. |
|
static |
Find out how long new buildings are still being funded in a town.
town_id | The town to check. |
|
static |
Get the amount of economy-days between town growth.
town_id | The index of the town. |
|
static |
Gets the number of houses in the town.
town_id | The town to get the number of houses of. |
Get the total last economy-month's production of the given cargo at a town.
town_id | The index of the town. |
cargo_id | The index of the cargo. |
|
static |
Get the total amount of cargo effects received by a town last economy-month.
town_id | The index of the town. |
towneffect_id | The index of the cargo. |
Get the total amount of cargo supplied from a town last economy-month.
town_id | The index of the town. |
cargo_id | The index of the cargo. |
Get the percentage of transported production of the given cargo at a town last economy-month.
town_id | The index of the town. |
cargo_id | The index of the cargo. |
Gets the location of the town.
town_id | The town to get the location of. |
|
static |
Get the name of the town.
town_id | The town to get the name of. |
|
static |
Gets the number of inhabitants in the town.
town_id | The town to get the population of. |
|
static |
Get the rating of a company within a town.
town_id | The town to get the rating for. |
company_id | The company to get the rating for. |
|
static |
Get the road layout for a town.
town_id | The town to get the road layout from. |
|
static |
Find out how long the town is undergoing road reconstructions.
town_id | The town to check. |
|
static |
Gets the number of towns.
|
static |
Find out if this town has a statue for the current company.
town_id | The town to check. |
|
static |
Find out if an action can currently be performed on the town.
town_id | The town to perform the action on. |
town_action | The action to perform on the town. |
|
static |
Find out if the town is a city.
town_id | The town to check. |
|
static |
Checks whether the given town index is valid.
town_id | The index to check. |
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.
town_id | The town to check. |
tile | The tile to check. |
|
static |
Perform a town action on this town.
town_id | The town to perform the action on. |
town_action | The action to perform on the town. |