OpenTTD Source 20250312-master-gcdcc6b491d
|
Command definitions related to companies. More...
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, CompanyManagerFace cmf) |
Change the company manager's face. | |
CommandCost | CmdSetCompanyColour (DoCommandFlags flags, LiveryScheme scheme, bool primary, Colours colour) |
Change the company's company-colour. | |
Command definitions related to companies.
Definition in file company_cmd.h.
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.
flags | Operation to perform. |
action | The action to perform. |
public_key | The public key of the client to add or remove. |
Definition at line 990 of file company_cmd.cpp.
References _current_company, CALCA_ADD, CALCA_REMOVE, CMD_ERROR, Execute, Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_company_pool >::GetIfValid(), InvalidateWindowData(), NETWORK_PUBLIC_KEY_LENGTH, SetWindowDirty(), BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test(), WC_CLIENT_LIST, and WC_COMPANY.
CommandCost CmdCompanyCtrl | ( | DoCommandFlags | flags, |
CompanyCtrlAction | cca, | ||
CompanyID | company_id, | ||
CompanyRemoveReason | reason, | ||
ClientID | client_id | ||
) |
Control the companies: add, delete, etc.
flags | operation to perform |
cca | action to perform |
company_id | company to perform the action on |
client_id | ClientID |
Definition at line 853 of file company_cmd.cpp.
References _company_manager_face, _local_company, _network_own_client_id, _network_server, _networking, AI::BroadcastNewEvent(), CCA_DELETE, CCA_NEW, CCA_NEW_AI, ChangeOwnershipOfCompanyItems(), NetworkClientInfo::client_id, NetworkClientInfo::client_playas, CloseWindowById(), CMD_ERROR, COMPANY_SPECTATOR, CompanyAdminRemove(), CRR_END, DoStartupNewCompany(), Execute, NetworkClientInfo::GetByClientID(), GetEncodedString(), Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_company_pool >::GetIfValid(), Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_company_pool >::GetNumItems(), Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_story_page_pool >::GetNumItems(), Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_goal_pool >::GetNumItems(), Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem< Tpool >::index, INVALID_OWNER, InvalidateWindowClassesData(), InvalidateWindowData(), CompanyProperties::is_ai, Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_company_pool >::IsValidID(), MarkWholeScreenDirty(), NetworkAdminCompanyNew(), NetworkServerNewCompany(), NetworkUpdateClientInfo(), Game::NewEvent(), SetLocalCompany(), AI::Stop(), SyncCompanySettings(), BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test(), WC_CLIENT_LIST, WC_COMPANY_LEAGUE, WC_GAME_OPTIONS, WC_MAIN_TOOLBAR, WC_NETWORK_STATUS_WINDOW, WC_SCRIPT_LIST, WC_SCRIPT_SETTINGS, and WN_NETWORK_STATUS_WINDOW_JOIN.
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).
flags | operation to perform |
money | the amount of money to transfer; max 20.000.000 |
dest_company | the company to transfer the money to |
Definition at line 1290 of file company_cmd.cpp.
References _current_company, _networking, _settings_game, CMD_ERROR, CompanyProperties::current_loan, GameSettings::economy, Execute, EXPENSES_OTHER, Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_company_pool >::Get(), CommandCost::GetCost(), GetDrawStringCompanyColour(), GetString(), EconomySettings::give_money, Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_company_pool >::IsValidID(), CompanyProperties::money, Backup< T >::Restore(), SubtractMoneyFromCompany(), and BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test().
CommandCost CmdRenameCompany | ( | DoCommandFlags | flags, |
const std::string & | text | ||
) |
Change the name of the company.
flags | operation to perform |
text | the new name or an empty string when resetting to the default |
Definition at line 1155 of file company_cmd.cpp.
References _current_company, AI::BroadcastNewEvent(), CMD_ERROR, CompanyAdminUpdate(), Execute, Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_company_pool >::Get(), GetString(), Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem< Tpool >::index, IsUniqueCompanyName(), MarkWholeScreenDirty(), MAX_LENGTH_COMPANY_NAME_CHARS, CompanyProperties::name, Game::NewEvent(), BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test(), and Utf8StringLength().
CommandCost CmdRenamePresident | ( | DoCommandFlags | flags, |
const std::string & | text | ||
) |
Change the name of the president.
flags | operation to perform |
text | the new name or an empty string when resetting to the default |
Definition at line 1202 of file company_cmd.cpp.
References _current_company, AI::BroadcastNewEvent(), CMD_ERROR, CompanyAdminUpdate(), Execute, Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_company_pool >::Get(), GetString(), Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem< Tpool >::index, InvalidateWindowClassesData(), IsUniquePresidentName(), MarkWholeScreenDirty(), MAX_LENGTH_PRESIDENT_NAME_CHARS, CompanyProperties::name, CompanyProperties::name_1, Game::NewEvent(), CompanyProperties::president_name, BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test(), Utf8StringLength(), and WC_COMPANY.
CommandCost CmdSetCompanyColour | ( | DoCommandFlags | flags, |
LiveryScheme | scheme, | ||
bool | primary, | ||
Colours | colour | ||
) |
Change the company's company-colour.
flags | operation to perform |
scheme | scheme to set |
primary | set first/second colour |
colour | new colour for vehicles, property, etc. |
Definition at line 1056 of file company_cmd.cpp.
References _company_colours, _current_company, AssignBit(), BuildOwnerLegend(), CMD_ERROR, CompanyProperties::colour, CompanyAdminUpdate(), Execute, Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_company_pool >::Get(), InvalidateWindowData(), Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_company_pool >::Iterate(), Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_vehicle_pool >::Iterate(), MarkWholeScreenDirty(), 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.
CommandCost CmdSetCompanyManagerFace | ( | DoCommandFlags | flags, |
CompanyManagerFace | cmf | ||
) |
Change the company manager's face.
flags | operation to perform |
cmf | face bitmasked |
Definition at line 1023 of file company_cmd.cpp.
References _current_company, CMD_ERROR, Execute, Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_company_pool >::Get(), IsValidCompanyManagerFace(), MarkWholeScreenDirty(), and BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test().