OpenTTD Source: src/economy_cmd.h File Reference

OpenTTD Source 14.0-RC3

Functions
economy_cmd.h File Reference
`#include "command_type.h"`
`#include "company_type.h"`

Go to the source code of this file.

## Functions
CommandCost | CmdBuyCompany (DoCommandFlag flags, CompanyID target_company, bool hostile_takeover)
| Buy up another company. More...

## Detailed Description

Command definitions related to the economy.

Definition in file economy_cmd.h.

## Function Documentation

## ◆ CmdBuyCompany()

CommandCost CmdBuyCompany | ( | DoCommandFlag | flags,
|  | CompanyID | target_company,
|  | bool | hostile_takeover
| ) |  |

Buy up another company.

When a competing company is gone bankrupt you get the chance to purchase that company.

Todo:
  currently this only works for AI companies

Parameters

  flags | type of operation
  target_company | company to buy up
  hostile_takeover | whether to buy up the company even if it is not bankrupt

Returns
  the cost of this operation or an error

Definition at line 2044 of file economy.cpp.

References _current_company, _local_company, _networking, CompanyProperties::bankrupt_asked, CalculateHostileTakeoverValue(), CMD_ERROR, DC_EXEC, EXPENSES_OTHER, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::GetIfValid(), HasBit(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, CompanyProperties::is_ai, and MayCompanyTakeOver().