OpenTTD Source  14.0-beta1
company_cmd.h File Reference
#include "command_type.h"
#include "company_type.h"
#include "livery.h"

Go to the source code of this file.

Functions

enum ClientID uint32_t enum Colours byte CommandCost CmdCompanyCtrl (DoCommandFlag flags, CompanyCtrlAction cca, CompanyID company_id, CompanyRemoveReason reason, ClientID client_id)
 Control the companies: add, delete, etc. More...
 
CommandCost CmdGiveMoney (DoCommandFlag flags, Money money, CompanyID dest_company)
 Transfer funds (money) from one company to another. More...
 
CommandCost CmdRenameCompany (DoCommandFlag flags, const std::string &text)
 Change the name of the company. More...
 
CommandCost CmdRenamePresident (DoCommandFlag flags, const std::string &text)
 Change the name of the president. More...
 
CommandCost CmdSetCompanyManagerFace (DoCommandFlag flags, CompanyManagerFace cmf)
 Change the company manager's face. More...
 
CommandCost CmdSetCompanyColour (DoCommandFlag flags, LiveryScheme scheme, bool primary, Colours colour)
 Change the company's company-colour. More...
 

Detailed Description

Command definitions related to companies.

Definition in file company_cmd.h.

Function Documentation

◆ CmdCompanyCtrl()

enum ClientID uint32_t enum Colours byte CommandCost CmdCompanyCtrl ( DoCommandFlag  flags,
CompanyCtrlAction  cca,
CompanyID  company_id,
CompanyRemoveReason  reason,
ClientID  client_id 
)

◆ CmdGiveMoney()

CommandCost CmdGiveMoney ( DoCommandFlag  flags,
Money  money,
CompanyID  dest_company 
)

Transfer funds (money) from one company to another.

To prevent abuse in multiplayer games you can only send money to other companies if you have paid off your loan (either explicitly, or implicitly given the fact that you have more money than loan).

Parameters
flagsoperation to perform
moneythe amount of money to transfer; max 20.000.000
dest_companythe company to transfer the money to
Returns
the cost of this operation or an error

Definition at line 1238 of file company_cmd.cpp.

References _current_company, _settings_game, CMD_ERROR, CompanyProperties::current_loan, DC_EXEC, GameSettings::economy, EXPENSES_OTHER, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::Get(), CommandCost::GetCost(), EconomySettings::give_money, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::IsValidID(), CompanyProperties::money, and return_cmd_error.

◆ CmdRenameCompany()

CommandCost CmdRenameCompany ( DoCommandFlag  flags,
const std::string &  text 
)

Change the name of the company.

Parameters
flagsoperation to perform
textthe new name or an empty string when resetting to the default
Returns
the cost of this operation or an error

Definition at line 1112 of file company_cmd.cpp.

References _current_company, CMD_ERROR, CompanyAdminUpdate(), DC_EXEC, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::Get(), IsUniqueCompanyName(), MarkWholeScreenDirty(), MAX_LENGTH_COMPANY_NAME_CHARS, CompanyProperties::name, return_cmd_error, and Utf8StringLength().

◆ CmdRenamePresident()

CommandCost CmdRenamePresident ( DoCommandFlag  flags,
const std::string &  text 
)

Change the name of the president.

Parameters
flagsoperation to perform
textthe new name or an empty string when resetting to the default
Returns
the cost of this operation or an error

Definition at line 1155 of file company_cmd.cpp.

References _current_company, CMD_ERROR, CompanyAdminUpdate(), DC_EXEC, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::Get(), IsUniquePresidentName(), MarkWholeScreenDirty(), MAX_LENGTH_PRESIDENT_NAME_CHARS, CompanyProperties::name, CompanyProperties::name_1, CompanyProperties::president_name, return_cmd_error, and Utf8StringLength().

◆ CmdSetCompanyColour()

CommandCost CmdSetCompanyColour ( DoCommandFlag  flags,
LiveryScheme  scheme,
bool  primary,
Colours  colour 
)

Change the company's company-colour.

Parameters
flagsoperation to perform
schemescheme to set
primaryset first/second colour
colournew colour for vehicles, property, etc.
Returns
the cost of this operation or an error

Definition at line 1013 of file company_cmd.cpp.

◆ CmdSetCompanyManagerFace()

CommandCost CmdSetCompanyManagerFace ( DoCommandFlag  flags,
CompanyManagerFace  cmf 
)

Change the company manager's face.

Parameters
flagsoperation to perform
cmfface bitmasked
Returns
the cost of this operation or an error

Definition at line 980 of file company_cmd.cpp.

References _current_company, CMD_ERROR, DC_EXEC, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::Get(), IsValidCompanyManagerFace(), and MarkWholeScreenDirty().