diff options
author | Peter Nelson <peter1138@openttd.org> | 2019-02-10 22:34:55 +0000 |
---|---|---|
committer | Charles Pigott <charlespigott@googlemail.com> | 2019-02-10 22:48:23 +0000 |
commit | cac2f6226c5cb81efb6aea747e3ef896504bca03 (patch) | |
tree | f88f620c9d380522981b87ee00c8652e77eb98ff | |
parent | 22f33fdd08aa2957f71acf11063da98b96a89712 (diff) | |
download | openttd-cac2f6226c5cb81efb6aea747e3ef896504bca03.tar.xz |
Codechange: In CmdCompanyCtrl, move client_id assignment to where it is used, and document bit usage better.
-rw-r--r-- | src/company_cmd.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/company_cmd.cpp b/src/company_cmd.cpp index 77572c5af..8cc876751 100644 --- a/src/company_cmd.cpp +++ b/src/company_cmd.cpp @@ -816,7 +816,9 @@ void CompanyAdminRemove(CompanyID company_id, CompanyRemoveReason reason) * @param p1 various functionality * - bits 0..15: CompanyCtrlAction * - bits 16..24: CompanyID - * @param p2 ClientID + * @param p2 various depending on CompanyCtrlAction + * - bits 0..31: ClientID (with CCA_NEW) + * - bits 0..1: CompanyRemoveReason (with CCA_DELETE) * @param text unused * @return the cost of this operation or an error */ @@ -824,9 +826,6 @@ CommandCost CmdCompanyCtrl(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3 { InvalidateWindowData(WC_COMPANY_LEAGUE, 0, 0); CompanyID company_id = (CompanyID)GB(p1, 16, 8); -#ifdef ENABLE_NETWORK - ClientID client_id = (ClientID)p2; -#endif /* ENABLE_NETWORK */ switch ((CompanyCtrlAction)GB(p1, 0, 16)) { case CCA_NEW: { // Create a new company @@ -836,6 +835,8 @@ CommandCost CmdCompanyCtrl(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3 #ifdef ENABLE_NETWORK /* Has the network client a correct ClientIndex? */ if (!(flags & DC_EXEC)) return CommandCost(); + + ClientID client_id = (ClientID)p2; NetworkClientInfo *ci = NetworkClientInfo::GetByClientID(client_id); #ifndef DEBUG_DUMP_COMMANDS /* When replaying the client ID is not a valid client; there |