OpenTTD GameScript API 20250426-master-gbb1d561369
|
Class that handles all company related functions. More...
#include <script_company.hpp>
Static Public Member Functions | |
static GSCompany::CompanyID | ResolveCompanyID (GSCompany::CompanyID company) |
Resolved the given company index to the correct index for the company. | |
static bool | IsMine (GSCompany::CompanyID company) |
Check if a CompanyID is your CompanyID, to ease up checks. | |
static bool | SetName (Text *name) |
Set the name of your company. | |
static string | GetName (GSCompany::CompanyID company) |
Get the name of the given company. | |
static bool | SetPresidentName (Text *name) |
Set the name of your president. | |
static string | GetPresidentName (GSCompany::CompanyID company) |
Get the name of the president of the given company. | |
static bool | SetPresidentGender (Gender gender) |
Set the gender of the president of your company. | |
static Gender | GetPresidentGender (GSCompany::CompanyID company) |
Get the gender of the president of the given company. | |
static bool | SetLoanAmount (Money loan) |
Sets the amount to loan. | |
static bool | SetMinimumLoanAmount (Money loan) |
Sets the minimum amount to loan, i.e. | |
static Money | GetLoanAmount () |
Gets the amount your company have loaned. | |
static Money | GetMaxLoanAmount () |
Gets the maximum amount your company can loan. | |
static bool | SetMaxLoanAmountForCompany (GSCompany::CompanyID company, Money amount) |
Sets the max amount of money company can loan. | |
static bool | ResetMaxLoanAmountForCompany (GSCompany::CompanyID company) |
Makes the max amount of money company can loan follow the global max loan setting. | |
static Money | GetLoanInterval () |
Gets the interval/loan step. | |
static Money | GetBankBalance (GSCompany::CompanyID company) |
Gets the bank balance. | |
static bool | ChangeBankBalance (GSCompany::CompanyID company, Money delta, ExpensesType expenses_type, TileIndex tile) |
Changes the bank balance by a delta value. | |
static Money | GetQuarterlyIncome (GSCompany::CompanyID company, int quarter) |
Get the income of the company in the given economy-quarter. | |
static Money | GetQuarterlyExpenses (GSCompany::CompanyID company, int quarter) |
Get the expenses of the company in the given economy-quarter. | |
static int | GetQuarterlyCargoDelivered (GSCompany::CompanyID company, int quarter) |
Get the amount of cargo delivered by the given company in the given economy-quarter. | |
static int | GetQuarterlyPerformanceRating (GSCompany::CompanyID company, int quarter) |
Get the performance rating of the given company in the given economy-quarter. | |
static Money | GetQuarterlyCompanyValue (GSCompany::CompanyID company, int quarter) |
Get the value of the company in the given economy-quarter. | |
static bool | BuildCompanyHQ (TileIndex tile) |
Build your company's HQ on the given tile. | |
static TileIndex | GetCompanyHQ (GSCompany::CompanyID company) |
Return the location of a company's HQ. | |
static bool | SetAutoRenewStatus (bool autorenew) |
Set whether autorenew is enabled for your company. | |
static bool | GetAutoRenewStatus (GSCompany::CompanyID company) |
Return whether autorenew is enabled for a company. | |
static bool | SetAutoRenewMonths (int months) |
Set the number of months before/after max age to autorenew an engine for your company. | |
static int | GetAutoRenewMonths (GSCompany::CompanyID company) |
Return the number of months before/after max age to autorenew an engine for a company. | |
static bool | SetAutoRenewMoney (Money money) |
Set the minimum money needed to autorenew an engine for your company. | |
static Money | GetAutoRenewMoney (GSCompany::CompanyID company) |
Return the minimum money needed to autorenew an engine for a company. | |
static bool | SetPrimaryLiveryColour (LiveryScheme scheme, Colours colour) |
Set primary colour for your company. | |
static bool | SetSecondaryLiveryColour (LiveryScheme scheme, Colours colour) |
Set secondary colour for your company. | |
static GSCompany::Colours | GetPrimaryLiveryColour (LiveryScheme scheme) |
Get primary colour of a livery for your company. | |
static GSCompany::Colours | GetSecondaryLiveryColour (LiveryScheme scheme) |
Get secondary colour of a livery for your company. | |
Class that handles all company related functions.
enum GSCompany::CompanyID |
Different constants related to CompanyID.
enum GSCompany::ExpensesType : int |
Types of expenses.
enum GSCompany::Gender |
List of different livery schemes.
enum GSCompany::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 |
Changes the bank balance by a delta value.
This method does not affect the loan but instead allows a GS to give or take money from a company.
company | The company to change the bank balance of. |
delta | Amount of money to give or take from the bank balance. A positive value adds money to the bank balance. |
expenses_type | The account in the finances window that will register the cost. |
tile | The tile to show text effect on or GSMap::TILE_INVALID |
|
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. |
|
static |
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 economy-quarter.
company | The company to get the amount of delivered cargo of. |
quarter | The economy-quarter to get the amount of delivered cargo of. |
|
static |
Get the value of the company in the given economy-quarter.
company | The company to get the value of. |
quarter | The economy-quarter to get the value of. |
|
static |
Get the expenses of the company in the given economy-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 economy-quarter to get the expenses of. |
|
static |
Get the income of the company in the given economy-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 economy-quarter to get the income of. |
|
static |
Get the performance rating of the given company in the given economy-quarter.
company | The company to get the performance rating of. |
quarter | The economy-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. |
|
static |
Makes the max amount of money company can loan follow the global max loan setting.
company | The company ID. |
|
static |
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 number of calendar-months before/after max age of engine. The value will be clamped to MIN(int) .. MAX(int). |
|
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 max amount of money company can loan.
company | The company ID. |
amount | Max loan amount. Will be rounded down to a multiple 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 GSText object). |
GSError::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 GSText object). |
GSError::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. |