OpenTTD Source  20240915-master-g3784a3d3d6
company_base.h File Reference
#include "road_type.h"
#include "livery.h"
#include "autoreplace_type.h"
#include "tile_type.h"
#include "timer/timer_game_economy.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
 
class  FreeUnitIDGenerator
 
struct  CompanyProperties
 Statically loadable part of Company pool item. More...
 
struct  Company
 

Typedefs

typedef Pool< Company, CompanyID, 1, MAX_COMPANIESCompanyPool
 

Functions

Money CalculateCompanyValue (const Company *c, bool including_loan=true)
 Calculate the value of the company. More...
 
Money CalculateHostileTakeoverValue (const Company *c)
 Calculate what you have to pay to take over a company. More...
 

Variables

static const Money COMPANY_MAX_LOAN_DEFAULT = INT64_MIN
 
CompanyPool _company_pool
 Pool of companies.
 
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

◆ CalculateCompanyValue()

Money CalculateCompanyValue ( const Company c,
bool  including_loan 
)

Calculate the value of the company.

That is the value of all assets (vehicles, stations) and money (including loan), except when including_loan is false which is useful when we want to calculate the value for bankruptcy.

Parameters
cthe company to get the value of.
including_loaninclude the loan in the company value.
Returns
the value of the company.

Definition at line 149 of file economy.cpp.

References CalculateCompanyAssetValue(), CompanyProperties::current_loan, and CompanyProperties::money.

◆ CalculateHostileTakeoverValue()

Money CalculateHostileTakeoverValue ( const Company c)

Calculate what you have to pay to take over a company.

This is different from bankruptcy and company value, and involves a few more parameters to make it more realistic.

You have to pay for:

  • The value of all the assets in the company.
  • The loan the company has (the investors really want their money back).
  • The profit for the next two years (if positive) based on the last four quarters.

And on top of that, they walk away with all the money they have in the bank.

Parameters
cthe company to get the value of.
Returns
The value of the company.

Definition at line 176 of file economy.cpp.

References CalculateCompanyAssetValue(), CompanyProperties::current_loan, CompanyEconomyEntry::expenses, CompanyEconomyEntry::income, CompanyProperties::money, and CompanyProperties::old_economy.

Referenced by CmdBuyCompany().