Definition of stuff that is very close to a company, like the company struct itself. More...
#include "core/pool_type.hpp"
#include "road_type.h"
#include "rail_type.h"
#include "livery.h"
#include "autoreplace_type.h"
#include "economy_type.h"
#include "tile_type.h"
#include "settings_type.h"
#include "command_type.h"
#include "table/strings.h"
Go to the source code of this file.
Data Structures | |
struct | CompanyEconomyEntry |
struct | CompanyProperties |
Statically loadable part of Company pool item. More... | |
struct | Company |
struct | CompanyProfile |
Defines | |
#define | FOR_ALL_COMPANIES_FROM(var, start) FOR_ALL_ITEMS_FROM(Company, company_index, var, start) |
#define | FOR_ALL_COMPANIES(var) FOR_ALL_COMPANIES_FROM(var, 0) |
Typedefs | |
typedef Pool< Company, CompanyByte, 1, MAX_COMPANIES > | CompanyPool |
Functions | |
CompanyProfile | GetCompanyProfile (const Company &) |
Build the CompanyProfile information from a given company. | |
StringID | SetCompanyProfile (const CompanyProfile &) |
Set a companies information from a CompanyProfile. | |
StringID | CompanyLoadProfile (CompanyProfile &) |
Load the company profile from the config. | |
StringID | CompanySaveProfile (const CompanyProfile &) |
Save the company profile information to the config. | |
Money | CalculateCompanyValue (const Company *c, bool including_loan=true) |
Calculate the value of the company. | |
Variables | |
CompanyPool | _company_pool |
Pool of companies. | |
uint | _next_competitor_start |
the number of ticks before the next AI is started | |
uint | _cur_company_tick_index |
used to generate a name for one company that doesn't have a name yet per tick |
Definition of stuff that is very close to a company, like the company struct itself.
Definition in file company_base.h.
Calculate the value of the company.
That is the value of all assets (vehicles, stations, etc) and money minus the loan, except when including_loan is false
which is useful when we want to calculate the value for bankruptcy.
c | the company to get the value of. | |
including_loan | include the loan in the company value. |
Definition at line 109 of file economy.cpp.
References CountBits(), CompanyProperties::current_loan, BaseStation::facilities, FOR_ALL_VEHICLES, SpecializedVehicle< Aircraft, VEH_AIRCRAFT >::From(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, Aircraft::IsNormalAircraft(), max(), CompanyProperties::money, Vehicle::owner, BaseStation::owner, BaseVehicle::type, Vehicle::value, VEH_AIRCRAFT, VEH_ROAD, VEH_SHIP, and VEH_TRAIN.
Referenced by CmdBuyShareInCompany(), CmdSellShareInCompany(), CompanyCheckBankrupt(), AICompany::GetCompanyValue(), CompanyWindow::SetStringParameters(), and UpdateCompanyRatingAndValue().
StringID CompanyLoadProfile | ( | CompanyProfile & | company_profile | ) |
Load the company profile from the config.
company_profile | CompanyProfile pointer to load into |
Definition at line 1931 of file settings.cpp.
References Livery::colour1, Livery::colour2, IniFile::GetGroup(), IniGroup::GetItem(), Livery::in_use, MAX_LENGTH_COMPANY_NAME_CHARS, MAX_LENGTH_PRESIDENT_NAME_CHARS, and IniItem::value.
Referenced by CompanyWindow::OnClick().
StringID CompanySaveProfile | ( | const CompanyProfile & | company_profile | ) |
Save the company profile information to the config.
company_profile | CompanyProfile to save |
Definition at line 1980 of file settings.cpp.
References _config_file, Livery::colour1, Livery::colour2, IniFile::GetGroup(), IniGroup::GetItem(), Livery::in_use, IniFile::RemoveGroup(), IniFile::SaveToDisk(), and IniItem::SetValue().
Referenced by CompanyWindow::OnClick().
CompanyProfile GetCompanyProfile | ( | const Company & | company | ) |
Build the CompanyProfile information from a given company.
company | The company to build from |
Definition at line 1867 of file settings.cpp.
References CompanyProperties::face, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, lastof, and SetDParam().
Referenced by CompanyWindow::OnClick().
StringID SetCompanyProfile | ( | const CompanyProfile & | company_profile | ) |
Set a companies information from a CompanyProfile.
company_profile | The CompanyProfile to use |
Definition at line 1892 of file settings.cpp.
References _company_pool, _local_company, CMD_RENAME_COMPANY, CMD_RENAME_PRESIDENT, CMD_SET_COMPANY_COLOUR, CMD_SET_COMPANY_MANAGER_FACE, Livery::colour1, Livery::colour2, DoCommandP(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::Get(), Livery::in_use, IsValidCompanyManagerFace(), lastof, MAX_LENGTH_COMPANY_NAME_CHARS, MAX_LENGTH_PRESIDENT_NAME_CHARS, and SetDParam().
Referenced by CompanyWindow::OnClick().