OpenTTD Source 20260208-master-g43af8e94d0
company_cmd.h File Reference

Command definitions related to companies. More...

#include "command_type.h"
#include "company_type.h"
#include "livery.h"

Go to the source code of this file.

Functions

CommandCost CmdCompanyCtrl (DoCommandFlags flags, CompanyCtrlAction cca, CompanyID company_id, CompanyRemoveReason reason, ClientID client_id)
 Control the companies: add, delete, etc.
CommandCost CmdCompanyAllowListCtrl (DoCommandFlags flags, CompanyAllowListCtrlAction action, const std::string &public_key)
 Add or remove the given public key to the allow list of this company.
CommandCost CmdGiveMoney (DoCommandFlags flags, Money money, CompanyID dest_company)
 Transfer funds (money) from one company to another.
CommandCost CmdRenameCompany (DoCommandFlags flags, const std::string &text)
 Change the name of the company.
CommandCost CmdRenamePresident (DoCommandFlags flags, const std::string &text)
 Change the name of the president.
CommandCost CmdSetCompanyManagerFace (DoCommandFlags flags, uint style, uint32_t bits)
 Change the company manager's face.
CommandCost CmdSetCompanyColour (DoCommandFlags flags, LiveryScheme scheme, bool primary, Colours colour)
 Change the company's company-colour.

Detailed Description

Command definitions related to companies.

Definition in file company_cmd.h.

Function Documentation

◆ CmdCompanyAllowListCtrl()

CommandCost CmdCompanyAllowListCtrl ( DoCommandFlags flags,
CompanyAllowListCtrlAction action,
const std::string & public_key )

Add or remove the given public key to the allow list of this company.

Parameters
flagsOperation to perform.
actionThe action to perform.
public_keyThe public key of the client to add or remove.
Returns
The cost of this operation or an error.

Definition at line 1028 of file company_cmd.cpp.

References _current_company, CALCA_ADD, CALCA_REMOVE, CMD_ERROR, Execute, InvalidateWindowData(), NETWORK_PUBLIC_KEY_LENGTH, SetWindowDirty(), BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test(), WC_CLIENT_LIST, and WC_COMPANY.

◆ CmdCompanyCtrl()

◆ CmdGiveMoney()

CommandCost CmdGiveMoney ( DoCommandFlags 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 1323 of file company_cmd.cpp.

References _current_company, _networking, _settings_game, CMD_ERROR, CompanyProperties::current_loan, Execute, EXPENSES_OTHER, CommandCost::GetCost(), GetDrawStringCompanyColour(), GetString(), CompanyProperties::money, SubtractMoneyFromCompany(), and BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test().

◆ CmdRenameCompany()

CommandCost CmdRenameCompany ( DoCommandFlags 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 1198 of file company_cmd.cpp.

References _current_company, AI::BroadcastNewEvent(), CMD_ERROR, CompanyAdminUpdate(), Execute, GetString(), InvalidateWindowClassesData(), IsUniqueCompanyName(), MarkWholeScreenDirty(), MAX_LENGTH_COMPANY_NAME_CHARS, CompanyProperties::name, Game::NewEvent(), BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test(), Utf8StringLength(), WC_COMPANY, and WID_C_COMPANY_NAME.

◆ CmdRenamePresident()

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

◆ CmdSetCompanyColour()

CommandCost CmdSetCompanyColour ( DoCommandFlags 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 1099 of file company_cmd.cpp.

References _company_colours, _current_company, BuildOwnerLegend(), CMD_ERROR, CompanyProperties::colour, CompanyAdminUpdate(), Execute, InvalidateWindowData(), MarkWholeScreenDirty(), Livery::Primary, Livery::Secondary, BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test(), UpdateCompanyLiveries(), UpdateObjectColours(), WC_COMPANY_VALUE, WC_DELIVERED_CARGO, WC_INCOME_GRAPH, WC_LINKGRAPH_LEGEND, WC_OPERATING_PROFIT, WC_PERFORMANCE_HISTORY, and WC_SMALLMAP.

◆ CmdSetCompanyManagerFace()

CommandCost CmdSetCompanyManagerFace ( DoCommandFlags flags,
uint style,
uint32_t bits )

Change the company manager's face.

Parameters
flagsoperation to perform
styleThe style of the company manager face.
bitsThe bits of company manager face.
Returns
the cost of this operation or an error

Definition at line 1062 of file company_cmd.cpp.

References _current_company, CompanyManagerFace::bits, CMD_ERROR, Execute, IsValidCompanyManagerFace(), MarkWholeScreenDirty(), SetCompanyManagerFaceStyle(), and BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test().