Data Structures | Defines | Typedefs | Functions | Variables

# company_base.h File Reference

Definition of stuff that is very close to a company, like the company struct itself. More...

`#include "road_type.h"`
`#include "livery.h"`
`#include "autoreplace_type.h"`
`#include "tile_type.h"`
`#include "settings_type.h"`
`#include "group.h"`

Go to the source code of this file.

## Data Structures
struct | CompanyEconomyEntry
| Statistics about the economy. More...
struct | CompanyInfrastructure
struct | CompanyProperties
| Statically loadable part of Company pool item. More...
struct | Company
## 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
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

## Detailed Description

Definition of stuff that is very close to a company, like the company struct itself.

Definition in file company_base.h.

## Function Documentation

Money CalculateCompanyValue | ( | const Company * | c,
|  | bool | including_loan |
| ) |  |  |

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.

Parameters:

  | c | the company to get the value of.
  | including_loan | include the loan in the company value.

Returns:
  the value of the company.

Definition at line 110 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(), CompanyWindow::SetStringParameters(), and UpdateCompanyRatingAndValue().