OpenTTD GameScript API 20241220-master-g59680867c3
|
Class that handles all town related functions. More...
#include <script_town.hpp>
Static Public Member Functions | |
static int | GetTownCount () |
Gets the number of towns. | |
static bool | IsValidTown (TownID town_id) |
Checks whether the given town index is valid. | |
static string | GetName (TownID town_id) |
Get the name of the town. | |
static bool | SetName (TownID town_id, Text *name) |
Rename a town. | |
static bool | SetText (TownID town_id, Text *text) |
Set the custom text of a town, shown in the GUI. | |
static int | GetPopulation (TownID town_id) |
Gets the number of inhabitants in the town. | |
static int | GetHouseCount (TownID town_id) |
Gets the number of houses in the town. | |
static TileIndex | GetLocation (TownID town_id) |
Gets the location of the town. | |
static int | GetLastMonthProduction (TownID town_id, CargoID cargo_id) |
Get the total last economy-month's production of the given cargo at a town. | |
static int | GetLastMonthSupplied (TownID town_id, CargoID cargo_id) |
Get the total amount of cargo supplied from a town last economy-month. | |
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. | |
static int | GetLastMonthReceived (TownID town_id, GSCargo::TownEffect towneffect_id) |
Get the total amount of cargo effects received by a town last economy-month. | |
static bool | SetCargoGoal (TownID town_id, GSCargo::TownEffect towneffect_id, int goal) |
Set the goal of a cargo per economy-month for this town. | |
static int | GetCargoGoal (TownID town_id, GSCargo::TownEffect towneffect_id) |
Get the amount of cargo per economy-month that needs to be delivered (per TownEffect) for a town to grow. | |
static bool | SetGrowthRate (TownID town_id, int days_between_town_growth) |
Set the amount of economy-days between town growth. | |
static int | GetGrowthRate (TownID town_id) |
Get the amount of economy-days between town growth. | |
static int | GetDistanceManhattanToTile (TownID town_id, TileIndex tile) |
Get the manhattan distance from the tile to the GSTown::GetLocation() of the town. | |
static int | GetDistanceSquareToTile (TownID town_id, TileIndex tile) |
Get the square distance from the tile to the GSTown::GetLocation() of the town. | |
static bool | IsWithinTownInfluence (TownID town_id, TileIndex tile) |
Find out if this tile is within the rating influence of a town. | |
static bool | HasStatue (TownID town_id) |
Find out if this town has a statue for the current company. | |
static bool | IsCity (TownID town_id) |
Find out if the town is a city. | |
static int | GetRoadReworkDuration (TownID town_id) |
Find out how long the town is undergoing road reconstructions. | |
static int | GetFundBuildingsDuration (TownID town_id) |
Find out how long new buildings are still being funded in a town. | |
static GSCompany::CompanyID | GetExclusiveRightsCompany (TownID town_id) |
Find out which company currently has the exclusive rights of this town. | |
static int | GetExclusiveRightsDuration (TownID town_id) |
Find out how long the town is under influence of the exclusive rights. | |
static bool | IsActionAvailable (TownID town_id, TownAction town_action) |
Find out if an action can currently be performed on the town. | |
static bool | PerformTownAction (TownID town_id, TownAction town_action) |
Perform a town action on this town. | |
static bool | ExpandTown (TownID town_id, int houses) |
Expand the town. | |
static bool | FoundTown (TileIndex tile, TownSize size, bool city, RoadLayout layout, Text *name) |
Found a new town. | |
static TownRating | GetRating (TownID town_id, GSCompany::CompanyID company_id) |
Get the rating of a company within a town. | |
static int | GetDetailedRating (TownID town_id, GSCompany::CompanyID company_id) |
Get the accurate rating of a company within a town. | |
static bool | ChangeRating (TownID town_id, GSCompany::CompanyID company_id, int delta) |
Change the rating of a company within a town. | |
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. | |
static RoadLayout | GetRoadLayout (TownID town_id) |
Get the road layout for a town. | |
Class that handles all town related functions.
enum GSTown::RoadLayout |
Possible layouts for the roads in a town.
enum GSTown::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 GSTown::TownGrowth |
enum GSTown::TownRating |
Different ratings one could have in a town.
enum GSTown::TownSize |
|
static |
Change the rating of a company within a town.
town_id | The town to change the rating in. |
company_id | The company to change the rating for. |
delta | How much to change rating by (range -1000 to +1000). |
|
static |
Expand the town.
town_id | The town to expand. |
houses | The amount of houses to grow the town with. The value will be clamped to 0 .. MAX(int). |
|
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. |
|
static |
Get the accurate 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. |
Get the manhattan distance from the tile to the GSTown::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 GSTown::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. |
|
static |
Set the goal of a cargo per economy-month for this town.
town_id | The index of the town. |
towneffect_id | The index of the towneffect. |
goal | The new goal amount for cargo delivered per economy-month. The value will be clamped to 0 .. MAX(int). |
|
static |
Set the amount of economy-days between town growth.
town_id | The index of the town. |
days_between_town_growth | The amount of economy-days between town growth, TOWN_GROWTH_NONE or TOWN_GROWTH_NORMAL. |
|
static |
Rename a town.
town_id | The town to rename |
name | The new name of the town. If null, or an empty string, is passed, the town name will be reset to the default name. |
|
static |
Set the custom text of a town, shown in the GUI.
town_id | The town to set the custom text of. |
text | The text to set it to (can be either a raw string, or a GSText object). If null, or an empty string, is passed, the text will be removed. |