OpenTTD Source
20241108-master-g80f628063a
|
Public Member Functions | |
Company (uint16_t name_1=0, bool is_ai=false) | |
Constructor. More... | |
~Company () | |
Destructor. | |
Money | GetMaxLoan () const |
Calculate the max allowed loan for this company. More... | |
Public Member Functions inherited from Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool > | |
void * | operator new (size_t size) |
Allocates space for new Titem. More... | |
void * | operator new (size_t size, size_t index) |
Allocates space for new Titem with given index. More... | |
void * | operator new (size_t, void *ptr) |
Allocates space for new Titem at given memory address. More... | |
void | operator delete (void *p) |
Marks Titem as free. More... | |
Static Public Member Functions | |
static bool | IsValidAiID (size_t index) |
Is this company a valid company, controlled by the computer (a NoAI program)? More... | |
static bool | IsValidHumanID (size_t index) |
Is this company a valid company, not controlled by a NoAI program? More... | |
static bool | IsHumanID (size_t index) |
Is this company a company not controlled by a NoAI program? More... | |
static void | PostDestructor (size_t index) |
Invalidating some stuff after removing item from the pool. More... | |
Static Public Member Functions inherited from Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool > | |
static bool | CanAllocateItem (size_t n=1) |
Helper functions so we can use PoolItem::Function() instead of _poolitem_pool.Function() More... | |
static bool | CleaningPool () |
Returns current state of pool cleaning - yes or no. More... | |
static bool | IsValidID (size_t index) |
Tests whether given index can be used to get valid (non-nullptr) Titem. More... | |
static Titem * | Get (size_t index) |
Returns Titem with given index. More... | |
static Titem * | GetIfValid (size_t index) |
Returns Titem with given index. More... | |
static size_t | GetPoolSize () |
Returns first unused index. More... | |
static size_t | GetNumItems () |
Returns number of valid items in the pool. More... | |
static void | PostDestructor ([[maybe_unused]] size_t index) |
Dummy function called after destructor of each member. More... | |
static Pool::IterateWrapper< Titem > | Iterate (size_t from=0) |
Returns an iterable ensemble of all valid Titem. More... | |
Data Fields | |
RailTypes | avail_railtypes |
Rail types available to this company. | |
RoadTypes | avail_roadtypes |
Road types available to this company. | |
std::unique_ptr< class AIInstance > | ai_instance |
class AIInfo * | ai_info |
std::unique_ptr< class AIConfig > | ai_config |
GroupStatistics | group_all [VEH_COMPANY_END] |
NOSAVE: Statistics for the ALL_GROUP group. | |
GroupStatistics | group_default [VEH_COMPANY_END] |
NOSAVE: Statistics for the DEFAULT_GROUP group. | |
CompanyInfrastructure | infrastructure |
NOSAVE: Counts of company owned infrastructure. | |
FreeUnitIDGenerator | freeunits [VEH_COMPANY_END] |
FreeUnitIDGenerator | freegroups |
Data Fields inherited from CompanyProperties | |
uint32_t | name_2 |
Parameter of name_1. | |
StringID | name_1 |
Name of the company if the user did not change it. | |
std::string | name |
Name of the company if the user changed it. | |
StringID | president_name_1 |
Name of the president if the user did not change it. | |
uint32_t | president_name_2 |
Parameter of president_name_1. | |
std::string | president_name |
Name of the president if the user changed it. | |
NetworkAuthorizedKeys | allow_list |
Public keys of clients that are allowed to join this company. | |
CompanyManagerFace | face |
Face description of the president. | |
Money | money |
Money owned by the company. | |
uint8_t | money_fraction |
Fraction of money of the company, too small to represent in money. | |
Money | current_loan |
Amount of money borrowed from the bank. | |
Money | max_loan |
Max allowed amount of the loan or COMPANY_MAX_LOAN_DEFAULT. | |
Colours | colour |
Company colour. | |
uint8_t | block_preview |
Number of quarters that the company is not allowed to get new exclusive engine previews (see CompaniesGenStatistics). | |
TileIndex | location_of_HQ |
Northern tile of HQ; INVALID_TILE when there is none. | |
TileIndex | last_build_coordinate |
Coordinate of the last build thing by this company. | |
TimerGameEconomy::Year | inaugurated_year |
Economy year of starting the company. | |
TimerGameCalendar::Year | inaugurated_year_calendar |
Calendar year of starting the company. Used to display proper Inauguration year while in wallclock mode. | |
uint8_t | months_empty = 0 |
NOSAVE: Number of months this company has not had a client in multiplayer. | |
uint8_t | months_of_bankruptcy |
Number of months that the company is unable to pay its debts. | |
CompanyMask | bankrupt_asked |
which companies were asked about buying it? | |
int16_t | bankrupt_timeout |
If bigger than 0 , amount of time to wait for an answer on an offer to buy this company. | |
Money | bankrupt_value |
uint32_t | terraform_limit |
Amount of tileheights we can (still) terraform (times 65536). | |
uint32_t | clear_limit |
Amount of tiles we can (still) clear (times 65536). | |
uint32_t | tree_limit |
Amount of trees we can (still) plant (times 65536). | |
uint32_t | build_object_limit |
Amount of tiles we can (still) build objects on (times 65536). Also applies to buying land. | |
bool | is_ai |
If true , the company is (also) controlled by the computer (a NoAI program). More... | |
std::array< Expenses, 3 > | yearly_expenses {} |
Expenses of the company for the last three years. | |
CompanyEconomyEntry | cur_economy |
Economic data of the company of this quarter. | |
CompanyEconomyEntry | old_economy [MAX_HISTORY_QUARTERS] |
Economic data of the company of the last MAX_HISTORY_QUARTERS quarters. | |
uint8_t | num_valid_stat_ent |
Number of valid statistical entries in old_economy. | |
Livery | livery [LS_END] |
EngineRenewList | engine_renew_list |
Engine renewals of this company. | |
CompanySettings | settings |
settings specific for each company | |
Data Fields inherited from Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool > | |
Tindex | index |
Index of this pool item. | |
Additional Inherited Members | |
Public Types inherited from Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool > | |
typedef struct Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero > | Pool |
Type of the pool this item is going to be part of. | |
Definition at line 133 of file company_base.h.
Company::Company | ( | uint16_t | name_1 = 0 , |
bool | is_ai = false |
||
) |
Constructor.
name_1 | Name of the company. |
is_ai | A computer program is running for this company. |
Definition at line 66 of file company_cmd.cpp.
Money Company::GetMaxLoan | ( | ) | const |
Calculate the max allowed loan for this company.
Definition at line 105 of file company_cmd.cpp.
References CompanyProperties::max_loan.
Referenced by CmdIncreaseLoan(), and CompanyCheckBankrupt().
|
inlinestatic |
Is this company a company not controlled by a NoAI program?
index | Index in the pool. |
true
if it is a human controlled company, else false
. Definition at line 184 of file company_base.h.
References Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::Get(), and Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::index.
Referenced by GetFirstPlayableCompanyID().
|
inlinestatic |
Is this company a valid company, controlled by the computer (a NoAI program)?
index | Index in the pool. |
true
if it is a valid, computer controlled company, else false
. Definition at line 159 of file company_base.h.
References Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::GetIfValid(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::index, and CompanyProperties::is_ai.
Referenced by ScriptDebugWindow::IsDead(), ScriptDebugWindow::IsValidDebugCompany(), AI::NewEvent(), AIConfigWindow::OnInvalidateData(), AI::ResetConfig(), StartScripts(), and ScriptDebugWindow::UpdateAIButtonsState().
|
inlinestatic |
Is this company a valid company, not controlled by a NoAI program?
index | Index in the pool. |
true
if it is a valid, human controlled company, else false
. Definition at line 171 of file company_base.h.
References Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::GetIfValid(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::index, and CompanyProperties::is_ai.
|
static |
Invalidating some stuff after removing item from the pool.
index | index of deleted item |
Definition at line 91 of file company_cmd.cpp.
References Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::index, InvalidateWindowData(), WC_COMPANY_LEAGUE, WC_ERRMSG, WC_GRAPH_LEGEND, WC_LINKGRAPH_LEGEND, and WC_PERFORMANCE_DETAIL.