10 #ifndef COMPANY_BASE_H
11 #define COMPANY_BASE_H
21 static const Money COMPANY_MAX_LOAN_DEFAULT = INT64_MIN;
33 std::array<uint32_t, RAILTYPE_END>
rail{};
34 std::array<uint32_t, ROADTYPE_END>
road{};
45 return std::accumulate(std::begin(this->
rail), std::end(this->
rail), 0U);
59 using BitmapStorage = size_t;
60 static constexpr
size_t BITMAP_SIZE = std::numeric_limits<BitmapStorage>::digits;
62 std::vector<BitmapStorage> used_bitmap;
101 Money bankrupt_value;
140 std::unique_ptr<class AIInstance> ai_instance;
142 std::unique_ptr<class AIConfig> ai_config;
162 return c !=
nullptr && c->
is_ai;
174 return c !=
nullptr && !c->
is_ai;
Types related to autoreplacing.
All static information from an AI like name, version, etc.
UnitID UseID(UnitID index)
Use a unit number.
void ReleaseID(UnitID index)
Release a unit number.
UnitID NextID() const
Find first unused unit number.
Simple helper to (more easily) manage authorized keys.
Money CalculateHostileTakeoverValue(const Company *c)
Calculate what you have to pay to take over a company.
Money CalculateCompanyValue(const Company *c, bool including_loan=true)
Calculate the value of the company.
uint _cur_company_tick_index
used to generate a name for one company that doesn't have a name yet per tick
CompanyPool _company_pool("Company")
Pool of companies.
static const uint MAX_HISTORY_QUARTERS
The maximum number of quarters kept as performance's history.
uint32_t CompanyManagerFace
Company manager face bits, info see in company_manager_face.h.
Base class for groups and group functions.
Functions/types related to livery colours.
RailTypes
Allow incrementing of Track variables.
Enums and other types related to roads.
RoadTypes
The different roadtypes we support, but then a bitmask of them.
Types related to global configuration settings.
uint32_t StringID
Numeric value that represents a string, independent of the selected language.
Class for storing amounts of cargo.
Statistics about the economy.
Money income
The amount of income.
Money expenses
The amount of expenses.
Money company_value
The value of the company.
CargoArray delivered_cargo
The amount of delivered cargo.
int32_t performance_history
Company score (scale 0-1000)
std::array< uint32_t, ROADTYPE_END > road
Count of company owned track bits for each road type.
uint32_t GetRailTotal() const
Get total sum of all owned track bits.
uint32_t GetRoadTotal() const
Get total sum of all owned road bits.
uint32_t station
Count of company owned station tiles.
uint32_t signal
Count of company owned signals.
std::array< uint32_t, RAILTYPE_END > rail
Count of company owned track bits for each rail type.
uint32_t GetTramTotal() const
Get total sum of all owned tram bits.
uint32_t airport
Count of company owned airports.
uint32_t water
Count of company owned track bits for canals.
Statically loadable part of Company pool item.
TileIndex location_of_HQ
Northern tile of HQ; INVALID_TILE when there is none.
uint8_t months_of_bankruptcy
Number of months that the company is unable to pay its debts.
uint32_t clear_limit
Amount of tiles we can (still) clear (times 65536).
CompanyMask bankrupt_asked
which companies were asked about buying it?
std::string president_name
Name of the president if the user changed it.
int16_t bankrupt_timeout
If bigger than 0, amount of time to wait for an answer on an offer to buy this company.
CompanySettings settings
settings specific for each company
NetworkAuthorizedKeys allow_list
Public keys of clients that are allowed to join this company.
uint8_t months_empty
NOSAVE: Number of months this company has not had a client in multiplayer.
CompanyEconomyEntry old_economy[MAX_HISTORY_QUARTERS]
Economic data of the company of the last MAX_HISTORY_QUARTERS quarters.
uint32_t build_object_limit
Amount of tiles we can (still) build objects on (times 65536). Also applies to buying land.
uint32_t name_2
Parameter of name_1.
uint8_t money_fraction
Fraction of money of the company, too small to represent in money.
bool is_ai
If true, the company is (also) controlled by the computer (a NoAI program).
uint32_t president_name_2
Parameter of president_name_1.
StringID name_1
Name of the company if the user did not change it.
Money current_loan
Amount of money borrowed from the bank.
TimerGameCalendar::Year inaugurated_year_calendar
Calendar year of starting the company. Used to display proper Inauguration year while in wallclock mo...
uint32_t terraform_limit
Amount of tileheights we can (still) terraform (times 65536).
TimerGameEconomy::Year inaugurated_year
Economy year of starting the company.
CompanyEconomyEntry cur_economy
Economic data of the company of this quarter.
Colours colour
Company colour.
uint32_t tree_limit
Amount of trees we can (still) plant (times 65536).
CompanyManagerFace face
Face description of the president.
EngineRenewList engine_renew_list
Engine renewals of this company.
Money max_loan
Max allowed amount of the loan or COMPANY_MAX_LOAN_DEFAULT.
std::array< Expenses, 3 > yearly_expenses
Expenses of the company for the last three years.
TileIndex last_build_coordinate
Coordinate of the last build thing by this company.
StringID president_name_1
Name of the president if the user did not change it.
uint8_t block_preview
Number of quarters that the company is not allowed to get new exclusive engine previews (see Companie...
std::string name
Name of the company if the user changed it.
Money money
Money owned by the company.
uint8_t num_valid_stat_ent
Number of valid statistical entries in old_economy.
Settings that can be set per company.
Money GetMaxLoan() const
Calculate the max allowed loan for this company.
CompanyInfrastructure infrastructure
NOSAVE: Counts of company owned infrastructure.
GroupStatistics group_default[VEH_COMPANY_END]
NOSAVE: Statistics for the DEFAULT_GROUP group.
static bool IsHumanID(size_t index)
Is this company a company not controlled by a NoAI program?
static bool IsValidAiID(size_t index)
Is this company a valid company, controlled by the computer (a NoAI program)?
RoadTypes avail_roadtypes
Road types available to this company.
RailTypes avail_railtypes
Rail types available to this company.
Company(uint16_t name_1=0, bool is_ai=false)
Constructor.
static void PostDestructor(size_t index)
Invalidating some stuff after removing item from the pool.
static bool IsValidHumanID(size_t index)
Is this company a valid company, not controlled by a NoAI program?
GroupStatistics group_all[VEH_COMPANY_END]
NOSAVE: Statistics for the ALL_GROUP group.
Struct to store engine replacements.
Statistics and caches on the vehicles in a group.
Information about a particular livery.
Base class for all PoolItems.
Tindex index
Index of this pool item.
static Titem * Get(size_t index)
Returns Titem with given index.
static Titem * GetIfValid(size_t index)
Returns Titem with given index.
Base class for all pools.
Definition of the game-economy-timer.
uint16_t UnitID
Type for the company global vehicle unit number.
@ VEH_COMPANY_END
Last company-ownable type.