Public Member Functions | Static Public Member Functions | Data Fields

Company Struct Reference

Inheritance diagram for Company:
Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool > CompanyProperties

Public Member Functions

 Company (uint16 name_1=0, bool is_ai=false)
 Constructor.
 ~Company ()
 Destructor.

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.

Data Fields

Livery livery [LS_END]
RoadTypes avail_roadtypes
 Road types available to this company.
class AIInstanceai_instance
class AIInfoai_info
EngineRenewList engine_renew_list
 Engine renewals of this company.
CompanySettings settings
 settings specific for each company
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.

Detailed Description

Definition at line 105 of file company_base.h.


Constructor & Destructor Documentation

Company::Company ( uint16  name_1 = 0,
bool  is_ai = false 
)

Constructor.

Parameters:
name_1 Name of the company.
is_ai A computer program is running for this company.

Definition at line 57 of file company_cmd.cpp.

References _settings_game, ConstructionSettings::clear_frame_burst, COMPANY_SPECTATOR, GameSettings::construction, INVALID_COMPANY, INVALID_TILE, InvalidateWindowData(), ConstructionSettings::terraform_frame_burst, and WC_PERFORMANCE_DETAIL.


Member Function Documentation

static bool Company::IsHumanID ( size_t  index  )  [inline, static]

Is this company a company not controlled by a NoAI program?

Parameters:
index Index in the pool.
Returns:
true if it is a human controlled company, else false.
Precondition:
index must be a valid CompanyID.
Note:
If you don't know whether index refers to a valid company, you should use IsValidHumanID() instead.

Definition at line 152 of file company_base.h.

References Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::Get().

Referenced by DisasterTick_Big_Ufo().

static bool Company::IsValidAiID ( size_t  index  )  [inline, static]

Is this company a valid company, controlled by the computer (a NoAI program)?

Parameters:
index Index in the pool.
Returns:
true if it is a valid, computer controlled company, else false.

Definition at line 127 of file company_base.h.

References Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::GetIfValid(), and CompanyProperties::is_ai.

Referenced by AIDebugWindow::AIDebugWindow(), AI::GameLoop(), GetCompanyInfo(), AI::NewEvent(), and AI::ResetConfig().

static bool Company::IsValidHumanID ( size_t  index  )  [inline, static]

Is this company a valid company, not controlled by a NoAI program?

Parameters:
index Index in the pool.
Returns:
true if it is a valid, human controlled company, else false.
Note:
If you know that index refers to a valid company, you can use IsHumanID() instead.

Definition at line 139 of file company_base.h.

References Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::GetIfValid(), and CompanyProperties::is_ai.

Referenced by AIConfigWindow::DrawWidget(), FormatString(), AIConfigWindow::IsEditable(), and NetworkServerSetCompanyPassword().

void Company::PostDestructor ( size_t  index  )  [static]

Invalidating some stuff after removing item from the pool.

Parameters:
index index of deleted item

Definition at line 81 of file company_cmd.cpp.

References InvalidateWindowData(), WC_COMPANY_LEAGUE, WC_ERRMSG, WC_GRAPH_LEGEND, and WC_PERFORMANCE_DETAIL.


The documentation for this struct was generated from the following files: