summaryrefslogtreecommitdiff
path: root/src/company_cmd.cpp
diff options
context:
space:
mode:
authorglx <glx@openttd.org>2019-02-04 18:06:19 +0100
committerglx22 <glx22@users.noreply.github.com>2019-02-04 21:08:36 +0100
commit8e7fe3973fc03561c828594ce3293c1ab3c15481 (patch)
tree14aece330e30ec3188f1f77f0ba0b138a8a86117 /src/company_cmd.cpp
parent33e3f4916173b4129cbbe60f94dae659a70edb83 (diff)
downloadopenttd-8e7fe3973fc03561c828594ce3293c1ab3c15481.tar.xz
Add: CompanyCtrlAction enum for CMD_COMPANY_CTRL actions
Diffstat (limited to 'src/company_cmd.cpp')
-rw-r--r--src/company_cmd.cpp15
1 files changed, 6 insertions, 9 deletions
diff --git a/src/company_cmd.cpp b/src/company_cmd.cpp
index cf66690f4..392f97afb 100644
--- a/src/company_cmd.cpp
+++ b/src/company_cmd.cpp
@@ -612,7 +612,7 @@ static bool MaybeStartNewCompany()
if (n < (uint)_settings_game.difficulty.max_no_competitors) {
/* Send a command to all clients to start up a new AI.
* Works fine for Multiplayer and Singleplayer */
- return DoCommandP(0, 1 | INVALID_COMPANY << 16, 0, CMD_COMPANY_CTRL);
+ return DoCommandP(0, CCA_NEW_AI | INVALID_COMPANY << 16, 0, CMD_COMPANY_CTRL);
}
return false;
@@ -810,10 +810,7 @@ void CompanyAdminRemove(CompanyID company_id, CompanyRemoveReason reason)
* @param tile unused
* @param flags operation to perform
* @param p1 various functionality
- * - bits 0..15:
- * = 0 - create a new company
- * = 1 - create a new AI company
- * = 2 - delete a company
+ * - bits 0..15: CompanyCtrlAction
* - bits 16..24: CompanyID
* @param p2 ClientID
* @param text unused
@@ -827,8 +824,8 @@ CommandCost CmdCompanyCtrl(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3
ClientID client_id = (ClientID)p2;
#endif /* ENABLE_NETWORK */
- switch (GB(p1, 0, 16)) {
- case 0: { // Create a new company
+ switch ((CompanyCtrlAction)GB(p1, 0, 16)) {
+ case CCA_NEW: { // Create a new company
/* This command is only executed in a multiplayer game */
if (!_networking) return CMD_ERROR;
@@ -878,7 +875,7 @@ CommandCost CmdCompanyCtrl(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3
break;
}
- case 1: { // Make a new AI company
+ case CCA_NEW_AI: { // Make a new AI company
if (!(flags & DC_EXEC)) return CommandCost();
if (company_id != INVALID_COMPANY && (company_id >= MAX_COMPANIES || Company::IsValidID(company_id))) return CMD_ERROR;
@@ -889,7 +886,7 @@ CommandCost CmdCompanyCtrl(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3
break;
}
- case 2: { // Delete a company
+ case CCA_DELETE: { // Delete a company
CompanyRemoveReason reason = (CompanyRemoveReason)GB(p2, 0, 2);
if (reason >= CRR_END) return CMD_ERROR;