OpenTTD Source 20241224-master-gf74b0cf984
|
Public Member Functions | |
Company (uint16_t name_1=0, bool is_ai=false) | |
Constructor. | |
~Company () | |
Destructor. | |
Money | GetMaxLoan () const |
Calculate the max allowed loan for this company. | |
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. | |
void * | operator new (size_t size, size_t index) |
Allocates space for new Titem with given index. | |
void * | operator new (size_t, void *ptr) |
Allocates space for new Titem at given memory address. | |
void | operator delete (void *p) |
Marks Titem as free. | |
Static Public Member Functions | |
static bool | IsValidAiID (size_t index) |
Is this company a valid company, controlled by the computer (a NoAI program)? | |
static bool | IsValidHumanID (size_t index) |
Is this company a valid company, not controlled by a NoAI program? | |
static bool | IsHumanID (size_t index) |
Is this company a company not controlled by a NoAI program? | |
static void | PostDestructor (size_t index) |
Invalidating some stuff after removing item from the pool. | |
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() | |
static bool | CleaningPool () |
Returns current state of pool cleaning - yes or no. | |
static bool | IsValidID (size_t index) |
Tests whether given index can be used to get valid (non-nullptr) Titem. | |
static Titem * | Get (size_t index) |
Returns Titem with given index. | |
static Titem * | GetIfValid (size_t index) |
Returns Titem with given index. | |
static size_t | GetPoolSize () |
Returns first unused index. | |
static size_t | GetNumItems () |
Returns number of valid items in the pool. | |
static void | PostDestructor (size_t index) |
Dummy function called after destructor of each member. | |
static Pool::IterateWrapper< Titem > | Iterate (size_t from=0) |
Returns an iterable ensemble of all valid Titem. | |
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). | |
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.
References _settings_game, ConstructionSettings::build_object_frame_burst, ConstructionSettings::clear_frame_burst, GameSettings::construction, INVALID_COMPANY, INVALID_TILE, InvalidateWindowData(), ConstructionSettings::terraform_frame_burst, ConstructionSettings::tree_frame_burst, and WC_PERFORMANCE_DETAIL.
Company::~Company | ( | ) |
Destructor.
Definition at line 80 of file company_cmd.cpp.
References Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::CleaningPool(), CloseCompanyWindows(), and Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::index.
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, and Economy::max_loan.
Referenced by CmdIncreaseLoan(), CompanyCheckBankrupt(), CompanyFinancesWindow::OnPaint(), and CompanyFinancesWindow::SetStringParameters().
|
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 DisasterTick_Big_Ufo(), and 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 AIConfigWindow::DrawWidget(), GetCompanyInfo(), ScriptDebugWindow::IsDead(), ScriptDebugWindow::IsValidDebugCompany(), AIPLChunkHandler::Load(), AI::NewEvent(), AIConfigWindow::OnInvalidateData(), AI::ResetConfig(), ScriptDebugWindow::SetStringParameters(), 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.
Referenced by AIConfigWindow::DrawWidget(), FormatString(), ServerNetworkGameSocketHandler::Receive_CLIENT_IDENTIFY(), and ServerNetworkGameSocketHandler::Receive_CLIENT_MOVE().
|
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.
std::unique_ptr<class AIConfig> Company::ai_config |
Definition at line 142 of file company_base.h.
class AIInfo* Company::ai_info |
Definition at line 141 of file company_base.h.
std::unique_ptr<class AIInstance> Company::ai_instance |
Definition at line 140 of file company_base.h.
RailTypes Company::avail_railtypes |
Rail types available to this company.
Definition at line 137 of file company_base.h.
Referenced by DisableEngineForCompany(), DoStartupNewCompany(), EnableEngineForCompany(), GetRailTypeDropDownList(), and IsEngineBuildable().
RoadTypes Company::avail_roadtypes |
Road types available to this company.
Definition at line 138 of file company_base.h.
Referenced by DisableEngineForCompany(), DoStartupNewCompany(), EnableEngineForCompany(), HasRoadTypeAvail(), and IsEngineBuildable().
FreeUnitIDGenerator Company::freegroups |
Definition at line 150 of file company_base.h.
FreeUnitIDGenerator Company::freeunits[VEH_COMPANY_END] |
Definition at line 149 of file company_base.h.
GroupStatistics Company::group_all[VEH_COMPANY_END] |
NOSAVE: Statistics for the ALL_GROUP group.
Definition at line 144 of file company_base.h.
Referenced by CheckTakeoverVehicleLimit(), GetFreeUnitNumber(), and GroupStatistics::UpdateAutoreplace().
GroupStatistics Company::group_default[VEH_COMPANY_END] |
NOSAVE: Statistics for the DEFAULT_GROUP group.
Definition at line 145 of file company_base.h.
Referenced by GroupStatistics::UpdateAutoreplace().
CompanyInfrastructure Company::infrastructure |
NOSAVE: Counts of company owned infrastructure.
Definition at line 147 of file company_base.h.
Referenced by CmdBuildBridge(), CmdBuildRailStation(), CmdBuildRailWaypoint(), CmdBuildRoad(), CmdBuildTunnel(), CmdConvertRail(), ConvertRoadTypeOwner(), DoBuildLock(), CompanyInfrastructureWindow::DrawWidget(), CompanyInfrastructureWindow::GetTotalMaintenanceCost(), RemoveLock(), RemoveRoad(), UpdateCompanyRoadInfrastructure(), and CompanyInfrastructureWindow::UpdateWidgetSize().