OpenTTD Source: src/company_cmd.h Source File

OpenTTD Source 15.0-RC2

company_cmd.h
Go to the documentation of this file.
1/*
2 * This file is part of OpenTTD.
3 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
4 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
5 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <https://www.gnu.org/licenses/old-licenses/gpl-2.0>.
6 */
7
10#ifndef COMPANY_CMD_H
11#define COMPANY_CMD_H
12
13#include "command_type.h"
14#include "company_type.h"
15#include "livery.h"
16
17enum ClientID : uint32_t;
18enum Colours : uint8_t;
19
20 CommandCost CmdCompanyCtrl(DoCommandFlags flags, CompanyCtrlAction cca, CompanyID company_id, CompanyRemoveReason reason, ClientID client_id);
21 CommandCost CmdCompanyAllowListCtrl(DoCommandFlags flags, CompanyAllowListCtrlAction action, const std::string &public_key);
22 CommandCost CmdGiveMoney(DoCommandFlags flags, Money money, CompanyID dest_company);
23 CommandCost CmdRenameCompany(DoCommandFlags flags, const std::string &text);
24 CommandCost CmdRenamePresident(DoCommandFlags flags, const std::string &text);
25 CommandCost CmdSetCompanyManagerFace(DoCommandFlags flags, uint style, uint32_t bits);
26 CommandCost CmdSetCompanyColour(DoCommandFlags flags, LiveryScheme scheme, bool primary, Colours colour);
27
28DEF_CMD_TRAIT(CMD_COMPANY_CTRL, CmdCompanyCtrl, CommandFlags({CommandFlag::Spectator, CommandFlag::ClientID, CommandFlag::NoEst}), CommandType::ServerSetting)
29DEF_CMD_TRAIT(CMD_COMPANY_ALLOW_LIST_CTRL, CmdCompanyAllowListCtrl, CommandFlag::NoEst, CommandType::ServerSetting)
30DEF_CMD_TRAIT(CMD_GIVE_MONEY, CmdGiveMoney, {}, CommandType::MoneyManagement)
31DEF_CMD_TRAIT(CMD_RENAME_COMPANY, CmdRenameCompany, {}, CommandType::CompanySetting)
32DEF_CMD_TRAIT(CMD_RENAME_PRESIDENT, CmdRenamePresident, {}, CommandType::CompanySetting)
33DEF_CMD_TRAIT(CMD_SET_COMPANY_MANAGER_FACE, CmdSetCompanyManagerFace, {}, CommandType::CompanySetting)
34DEF_CMD_TRAIT(CMD_SET_COMPANY_COLOUR, CmdSetCompanyColour, {}, CommandType::CompanySetting)
35
36#endif /* COMPANY_CMD_H */
CommandCost
Common return value for all commands.
Definition command_type.h:24
EnumBitSet
Enum-as-bit-set wrapper.
Definition enum_type.hpp:177
OverflowSafeInt< int64_t >
command_type.h
Types related to commands.
CommandType::MoneyManagement
@ MoneyManagement
Management of money, i.e. loans.
CommandType::CompanySetting
@ CompanySetting
Changing settings related to a company.
CommandType::ServerSetting
@ ServerSetting
Pausing/removing companies/server settings.
CommandFlag::NoEst
@ NoEst
the command is never estimated.
CommandFlag::Spectator
@ Spectator
the command may be initiated by a spectator
CommandFlag::ClientID
@ ClientID
set p2 with the ClientID of the sending client.
CMD_COMPANY_CTRL
@ CMD_COMPANY_CTRL
used in multiplayer to create a new companies etc.
Definition command_type.h:312
CMD_RENAME_COMPANY
@ CMD_RENAME_COMPANY
change the company name
Definition command_type.h:276
CMD_SET_COMPANY_MANAGER_FACE
@ CMD_SET_COMPANY_MANAGER_FACE
set the manager's face of the company
Definition command_type.h:264
CMD_GIVE_MONEY
@ CMD_GIVE_MONEY
give money to another company
Definition command_type.h:341
CMD_RENAME_PRESIDENT
@ CMD_RENAME_PRESIDENT
change the president name
Definition command_type.h:277
CMD_COMPANY_ALLOW_LIST_CTRL
@ CMD_COMPANY_ALLOW_LIST_CTRL
Used in multiplayer to add/remove a client's public key to/from the company's allow list.
Definition command_type.h:313
CMD_SET_COMPANY_COLOUR
@ CMD_SET_COMPANY_COLOUR
set the colour of the company
Definition command_type.h:265
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.
Definition company_cmd.cpp:1023
CmdSetCompanyColour
CommandCost CmdSetCompanyColour(DoCommandFlags flags, LiveryScheme scheme, bool primary, Colours colour)
Change the company's company-colour.
Definition company_cmd.cpp:1094
CmdCompanyCtrl
CommandCost CmdCompanyCtrl(DoCommandFlags flags, CompanyCtrlAction cca, CompanyID company_id, CompanyRemoveReason reason, ClientID client_id)
Control the companies: add, delete, etc.
Definition company_cmd.cpp:881
CmdSetCompanyManagerFace
CommandCost CmdSetCompanyManagerFace(DoCommandFlags flags, uint style, uint32_t bits)
Change the company manager's face.
Definition company_cmd.cpp:1057
CmdRenamePresident
CommandCost CmdRenamePresident(DoCommandFlags flags, const std::string &text)
Change the name of the president.
Definition company_cmd.cpp:1240
CmdGiveMoney
CommandCost CmdGiveMoney(DoCommandFlags flags, Money money, CompanyID dest_company)
Transfer funds (money) from one company to another.
Definition company_cmd.cpp:1316
CmdRenameCompany
CommandCost CmdRenameCompany(DoCommandFlags flags, const std::string &text)
Change the name of the company.
Definition company_cmd.cpp:1193
company_type.h
Types related to companies.
CompanyCtrlAction
CompanyCtrlAction
The action to do with CMD_COMPANY_CTRL.
Definition company_type.h:71
CompanyAllowListCtrlAction
CompanyAllowListCtrlAction
The action to do with CMD_COMPANY_ALLOW_LIST_CTRL.
Definition company_type.h:80
CompanyRemoveReason
CompanyRemoveReason
The reason why the company was removed.
Definition company_type.h:60
livery.h
Functions/types related to livery colours.
LiveryScheme
LiveryScheme
List of different livery schemes.
Definition livery.h:22
ClientID
ClientID
'Unique' identifier to be given to clients
Definition network_type.h:43
PoolID< uint8_t, struct CompanyIDTag, 0xF, 0xFF >