|
OpenTTD Source 20251116-master-g21329071df
|
Public Member Functions | |
| Company (StringID name_1={}, bool is_ai=false) | |
| Constructor. | |
| ~Company () | |
| Destructor. | |
| Money | GetMaxLoan () const |
| Calculate the max allowed loan for this company. | |
| uint8_t | GetCompanyRecolourOffset (LiveryScheme livery_scheme, bool use_secondary=true) const |
| Get offset for recolour palette of specific company. | |
Public Member Functions inherited from Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_company_pool > | |
| void * | operator new (size_t size) |
| Allocates space for new Titem. | |
| void * | operator new (size_t size, Tindex 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, size_t size) |
| Marks Titem as free. | |
Static Public Member Functions | |
| static bool | IsValidAiID (auto index) |
| Is this company a valid company, controlled by the computer (a NoAI program)? | |
| static bool | IsValidHumanID (auto index) |
| Is this company a valid company, not controlled by a NoAI program? | |
| static bool | IsHumanID (auto 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, Tpool_type, Tcache >::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 (auto index) |
| Tests whether given index can be used to get valid (non-nullptr) Titem. | |
| static Titem * | Get (auto index) |
| Returns Titem with given index. | |
| static Titem * | GetIfValid (auto 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 = nullptr |
| std::unique_ptr< class AIConfig > | ai_config {} |
| std::array< GroupStatistics, VEH_COMPANY_END > | group_all {} |
| NOSAVE: Statistics for the ALL_GROUP group. | |
| std::array< GroupStatistics, VEH_COMPANY_END > | group_default {} |
| NOSAVE: Statistics for the DEFAULT_GROUP group. | |
| CompanyInfrastructure | infrastructure {} |
| NOSAVE: Counts of company owned infrastructure. | |
| std::array< FreeUnitIDGenerator, VEH_COMPANY_END > | freeunits {} |
| FreeUnitIDGenerator | freegroups {} |
Data Fields inherited from CompanyProperties | |
| uint32_t | name_2 = 0 |
| Parameter of name_1. | |
| StringID | name_1 = INVALID_STRING_ID |
| 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 = INVALID_STRING_ID |
| Name of the president if the user did not change it. | |
| uint32_t | president_name_2 = 0 |
| 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 = 0 |
| Money owned by the company. | |
| uint8_t | money_fraction = 0 |
| Fraction of money of the company, too small to represent in money. | |
| Money | current_loan = 0 |
| Amount of money borrowed from the bank. | |
| Money | max_loan = COMPANY_MAX_LOAN_DEFAULT |
| Max allowed amount of the loan or COMPANY_MAX_LOAN_DEFAULT. | |
| Colours | colour = COLOUR_BEGIN |
| Company colour. | |
| uint8_t | block_preview = 0 |
| Number of quarters that the company is not allowed to get new exclusive engine previews (see CompaniesGenStatistics). | |
| TileIndex | location_of_HQ = INVALID_TILE |
| 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 = 0 |
| 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 = 0 |
If bigger than 0, amount of time to wait for an answer on an offer to buy this company. | |
| Money | bankrupt_value = 0 |
| uint32_t | terraform_limit = 0 |
| Amount of tileheights we can (still) terraform (times 65536). | |
| uint32_t | clear_limit = 0 |
| Amount of tiles we can (still) clear (times 65536). | |
| uint32_t | tree_limit = 0 |
| Amount of trees we can (still) plant (times 65536). | |
| uint32_t | build_object_limit = 0 |
| Amount of tiles we can (still) build objects on (times 65536). Also applies to buying land. | |
| bool | is_ai = false |
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. | |
| std::array< CompanyEconomyEntry, MAX_HISTORY_QUARTERS > | old_economy {} |
| Economic data of the company of the last MAX_HISTORY_QUARTERS quarters. | |
| uint8_t | num_valid_stat_ent = 0 |
| Number of valid statistical entries in old_economy. | |
| std::array< Livery, LS_END > | livery {} |
| EngineRenewList | engine_renew_list = nullptr |
| Engine renewals of this company. | |
| CompanySettings | settings {} |
| settings specific for each company | |
Data Fields inherited from Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_company_pool > | |
| Tindex | index |
| Index of this pool item. | |
Additional Inherited Members | |
Public Types inherited from Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_company_pool > | |
| typedef struct Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache > | Pool |
| Type of the pool this item is going to be part of. | |
Definition at line 127 of file company_base.h.
| Company::Company | ( | StringID | name_1 = {}, |
| bool | is_ai = false |
||
| ) |
Constructor.
| name_1 | Name of the company. |
| is_ai | A computer program is running for this company. |
Definition at line 69 of file company_cmd.cpp.
References _settings_game, ConstructionSettings::build_object_frame_burst, ConstructionSettings::clear_frame_burst, GameSettings::construction, InvalidateWindowData(), ConstructionSettings::terraform_frame_burst, ConstructionSettings::tree_frame_burst, and WC_PERFORMANCE_DETAIL.
| Company::~Company | ( | ) |
Destructor.
Definition at line 82 of file company_cmd.cpp.
References Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_company_pool >::CleaningPool(), CloseCompanyWindows(), and Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_company_pool >::index.
|
inline |
Get offset for recolour palette of specific company.
| livery_scheme | Scheme to use for recolour. |
| use_secondary | Specify whether to add secondary colour offset to the result. |
Definition at line 189 of file company_base.h.
References Livery::colour1, and Livery::colour2.
Referenced by IndustriesScopeResolver::GetVariable(), and UpdateObjectColours().
| Money Company::GetMaxLoan | ( | ) | const |
Calculate the max allowed loan for this company.
Definition at line 107 of file company_cmd.cpp.
References CompanyProperties::max_loan, and Economy::max_loan.
Referenced by CmdIncreaseLoan(), CompanyCheckBankrupt(), CompanyFinancesWindow::GetWidgetString(), and CompanyFinancesWindow::OnPaint().
|
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 178 of file company_base.h.
References Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_company_pool >::Get(), and Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::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 153 of file company_base.h.
References Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_company_pool >::GetIfValid(), Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_company_pool >::index, and CompanyProperties::is_ai.
Referenced by GetCompanyInfo(), AIConfigWindow::GetSlotColour(), ScriptDebugWindow::GetWidgetString(), ScriptDebugWindow::IsDead(), ScriptDebugWindow::IsValidDebugCompany(), AIPLChunkHandler::Load(), 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 165 of file company_base.h.
References Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_company_pool >::GetIfValid(), Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_company_pool >::index, and CompanyProperties::is_ai.
Referenced by FormatString(), AIConfigWindow::GetSlotText(), 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 93 of file company_cmd.cpp.
References Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::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 136 of file company_base.h.
| class AIInfo* Company::ai_info = nullptr |
Definition at line 135 of file company_base.h.
| std::unique_ptr<class AIInstance> Company::ai_instance {} |
Definition at line 134 of file company_base.h.
| RailTypes Company::avail_railtypes {} |
Rail types available to this company.
Definition at line 131 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 132 of file company_base.h.
Referenced by DisableEngineForCompany(), DoStartupNewCompany(), EnableEngineForCompany(), HasRoadTypeAvail(), and IsEngineBuildable().
| FreeUnitIDGenerator Company::freegroups {} |
Definition at line 144 of file company_base.h.
| std::array<FreeUnitIDGenerator, VEH_COMPANY_END> Company::freeunits {} |
Definition at line 143 of file company_base.h.
| std::array<GroupStatistics, VEH_COMPANY_END> Company::group_all {} |
NOSAVE: Statistics for the ALL_GROUP group.
Definition at line 138 of file company_base.h.
Referenced by CheckTakeoverVehicleLimit(), GetFreeUnitNumber(), and GroupStatistics::UpdateAutoreplace().
| std::array<GroupStatistics, VEH_COMPANY_END> Company::group_default {} |
NOSAVE: Statistics for the DEFAULT_GROUP group.
Definition at line 139 of file company_base.h.
Referenced by GroupStatistics::UpdateAutoreplace().
| CompanyInfrastructure Company::infrastructure {} |
NOSAVE: Counts of company owned infrastructure.
Definition at line 141 of file company_base.h.
Referenced by CmdBuildBridge(), CmdBuildRailStation(), CmdBuildRailWaypoint(), CmdBuildRoad(), CmdBuildTunnel(), CmdConvertRail(), ConvertRoadTypeOwner(), DoBuildLock(), RemoveLock(), RemoveRoad(), and UpdateCompanyRoadInfrastructure().