OpenTTD AI API
20240426-master-ga60a81f34e
|
Class that handles all company related functions. More...
Public Types | |
enum | Quarter { CURRENT_QUARTER, EARLIEST_QUARTER } |
The range of possible quarters to get company information of. More... | |
enum | CompanyID { COMPANY_FIRST, COMPANY_LAST, COMPANY_INVALID, COMPANY_SELF, COMPANY_SPECTATOR } |
Different constants related to CompanyID. More... | |
enum | Gender { GENDER_MALE, GENDER_FEMALE, GENDER_INVALID } |
Possible genders for company presidents. More... | |
enum | LiveryScheme { LS_DEFAULT, LS_STEAM, LS_DIESEL, LS_ELECTRIC, LS_MONORAIL, LS_MAGLEV, LS_DMU, LS_EMU, LS_PASSENGER_WAGON_STEAM, LS_PASSENGER_WAGON_DIESEL, LS_PASSENGER_WAGON_ELECTRIC, LS_PASSENGER_WAGON_MONORAIL, LS_PASSENGER_WAGON_MAGLEV, LS_FREIGHT_WAGON, LS_BUS, LS_TRUCK, LS_PASSENGER_SHIP, LS_FREIGHT_SHIP, LS_HELICOPTER, LS_SMALL_PLANE, LS_LARGE_PLANE, LS_PASSENGER_TRAM, LS_FREIGHT_TRAM, LS_INVALID } |
List of different livery schemes. More... | |
enum | Colours { COLOUR_DARK_BLUE, COLOUR_PALE_GREEN, COLOUR_PINK, COLOUR_YELLOW, COLOUR_RED, COLOUR_LIGHT_BLUE, COLOUR_GREEN, COLOUR_DARK_GREEN, COLOUR_BLUE, COLOUR_CREAM, COLOUR_MAUVE, COLOUR_PURPLE, COLOUR_ORANGE, COLOUR_BROWN, COLOUR_GREY, COLOUR_WHITE, COLOUR_INVALID = ::INVALID_COLOUR } |
List of colours. | |
Static Public Member Functions | |
static CompanyID | ResolveCompanyID (CompanyID company) |
Resolved the given company index to the correct index for the company. More... | |
static bool | IsMine (CompanyID company) |
Check if a CompanyID is your CompanyID, to ease up checks. More... | |
static bool | SetName (Text *name) |
Set the name of your company. More... | |
static std::optional< std::string > | GetName (CompanyID company) |
Get the name of the given company. More... | |
static bool | SetPresidentName (Text *name) |
Set the name of your president. More... | |
static std::optional< std::string > | GetPresidentName (CompanyID company) |
Get the name of the president of the given company. More... | |
static bool | SetPresidentGender (Gender gender) |
Set the gender of the president of your company. More... | |
static Gender | GetPresidentGender (CompanyID company) |
Get the gender of the president of the given company. More... | |
static bool | SetLoanAmount (Money loan) |
Sets the amount to loan. More... | |
static bool | SetMinimumLoanAmount (Money loan) |
Sets the minimum amount to loan, i.e. More... | |
static Money | GetLoanAmount () |
Gets the amount your company have loaned. More... | |
static Money | GetMaxLoanAmount () |
Gets the maximum amount your company can loan. More... | |
static Money | GetLoanInterval () |
Gets the interval/loan step. More... | |
static Money | GetBankBalance (CompanyID company) |
Gets the bank balance. More... | |
static Money | GetQuarterlyIncome (CompanyID company, SQInteger quarter) |
Get the income of the company in the given quarter. More... | |
static Money | GetQuarterlyExpenses (CompanyID company, SQInteger quarter) |
Get the expenses of the company in the given quarter. More... | |
static SQInteger | GetQuarterlyCargoDelivered (CompanyID company, SQInteger quarter) |
Get the amount of cargo delivered by the given company in the given quarter. More... | |
static SQInteger | GetQuarterlyPerformanceRating (CompanyID company, SQInteger quarter) |
Get the performance rating of the given company in the given quarter. More... | |
static Money | GetQuarterlyCompanyValue (CompanyID company, SQInteger quarter) |
Get the value of the company in the given quarter. More... | |
static bool | BuildCompanyHQ (TileIndex tile) |
Build your company's HQ on the given tile. More... | |
static TileIndex | GetCompanyHQ (CompanyID company) |
Return the location of a company's HQ. More... | |
static bool | SetAutoRenewStatus (bool autorenew) |
Set whether autorenew is enabled for your company. More... | |
static bool | GetAutoRenewStatus (CompanyID company) |
Return whether autorenew is enabled for a company. More... | |
static bool | SetAutoRenewMonths (SQInteger months) |
Set the number of months before/after max age to autorenew an engine for your company. More... | |
static SQInteger | GetAutoRenewMonths (CompanyID company) |
Return the number of months before/after max age to autorenew an engine for a company. More... | |
static bool | SetAutoRenewMoney (Money money) |
Set the minimum money needed to autorenew an engine for your company. More... | |
static Money | GetAutoRenewMoney (CompanyID company) |
Return the minimum money needed to autorenew an engine for a company. More... | |
static bool | SetPrimaryLiveryColour (LiveryScheme scheme, Colours colour) |
Set primary colour for your company. More... | |
static bool | SetSecondaryLiveryColour (LiveryScheme scheme, Colours colour) |
Set secondary colour for your company. More... | |
static AICompany::Colours | GetPrimaryLiveryColour (LiveryScheme scheme) |
Get primary colour of a livery for your company. More... | |
static AICompany::Colours | GetSecondaryLiveryColour (LiveryScheme scheme) |
Get secondary colour of a livery for your company. More... | |
Class that handles all company related functions.
enum AICompany::CompanyID |
Different constants related to CompanyID.
enum AICompany::Gender |
List of different livery schemes.
enum AICompany::Quarter |
|
static |
Build your company's HQ on the given tile.
tile | The tile to build your HQ on, this tile is the most northern tile of your HQ. |
|
static |
Return the minimum money needed to autorenew an engine for a company.
company | The company to get the autorenew money of. |
|
static |
Return the number of months before/after max age to autorenew an engine for a company.
company | The company to get the autorenew months of. |
|
static |
Return whether autorenew is enabled for a company.
company | The company to get the autorenew status of. |
|
static |
Gets the bank balance.
In other words, the amount of money the given company can spent. If infinite money is enabled, it returns INT32_MAX.
company | The company to get the bank balance of. |
|
static |
Return the location of a company's HQ.
company | The company the get the HQ of. |
|
static |
Gets the amount your company have loaned.
|
static |
Gets the interval/loan step.
|
static |
Gets the maximum amount your company can loan.
In deity mode returns the global max loan.
|
static |
Get the name of the given company.
company | The company to get the name for. |
Get the gender of the president of the given company.
company | The company to get the presidents gender off. |
|
static |
Get the name of the president of the given company.
company | The company to get the president's name for. |
|
static |
Get primary colour of a livery for your company.
scheme | Livery scheme to get. |
|
static |
Get the amount of cargo delivered by the given company in the given quarter.
company | The company to get the amount of delivered cargo of. |
quarter | The quarter to get the amount of delivered cargo of. |
|
static |
Get the value of the company in the given quarter.
company | The company to get the value of. |
quarter | The quarter to get the value of. |
|
static |
Get the expenses of the company in the given quarter.
Note that this function only considers recurring expenses from vehicle running cost, maintenance and interests; it does not include one-time expenses from construction and buying stuff.
company | The company to get the quarterly expenses of. |
quarter | The quarter to get the expenses of. |
|
static |
Get the income of the company in the given quarter.
Note that this function only considers recurring income from vehicles; it does not include one-time income from selling stuff.
company | The company to get the quarterly income of. |
quarter | The quarter to get the income of. |
|
static |
Get the performance rating of the given company in the given quarter.
company | The company to get the performance rating of. |
quarter | The quarter to get the performance rating of. |
|
static |
Get secondary colour of a livery for your company.
scheme | Livery scheme to get. |
|
static |
Check if a CompanyID is your CompanyID, to ease up checks.
company | The company index to check. |
Resolved the given company index to the correct index for the company.
If the company index was COMPANY_SELF it will be resolved to the index of your company. If the company with the given index does not exist it will return COMPANY_INVALID.
company | The company index to resolve. |
|
static |
Set the minimum money needed to autorenew an engine for your company.
money | The new minimum required money for autorenew to work. |
|
static |
Set the number of months before/after max age to autorenew an engine for your company.
months | The new months between autorenew. The value will be clamped to MIN(int16_t) .. MAX(int16_t). |
|
static |
Set whether autorenew is enabled for your company.
autorenew | The new autorenew status. |
|
static |
Sets the amount to loan.
loan | The amount to loan (multiplier of GetLoanInterval()). |
|
static |
Sets the minimum amount to loan, i.e.
the given amount of loan rounded up.
loan | The amount to loan (any positive number). |
|
static |
Set the name of your company.
name | The new name of the company (can be either a raw string, or a AIText object). |
AIError::ERR_NAME_IS_NOT_UNIQUE |
|
static |
Set the gender of the president of your company.
gender | The new gender for your president. |
|
static |
Set the name of your president.
name | The new name of the president (can be either a raw string, or a AIText object). |
AIError::ERR_NAME_IS_NOT_UNIQUE |
|
static |
Set primary colour for your company.
scheme | Livery scheme to set. |
colour | Colour to set. |
|
static |
Set secondary colour for your company.
scheme | Livery scheme to set. |
colour | Colour to set. |