diff options
author | Michael Lutz <michi@icosahedron.de> | 2021-10-03 21:13:32 +0200 |
---|---|---|
committer | Michael Lutz <michi@icosahedron.de> | 2021-12-16 22:28:32 +0100 |
commit | a38bbefe1b28ac59b2a9fef45765fa3890cde32e (patch) | |
tree | 8d842f88a25db5ce231ce5bdb0d39914b7e2ed70 /src/order_gui.cpp | |
parent | 549caca39cebc8c988f4e51d79d353cab4646d58 (diff) | |
download | openttd-a38bbefe1b28ac59b2a9fef45765fa3890cde32e.tar.xz |
Codechange: Untangle command code, flags and error string for DoCommand*.
Diffstat (limited to 'src/order_gui.cpp')
-rw-r--r-- | src/order_gui.cpp | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/src/order_gui.cpp b/src/order_gui.cpp index 8ec4e7e98..b934b9d16 100644 --- a/src/order_gui.cpp +++ b/src/order_gui.cpp @@ -591,7 +591,7 @@ private: } if (order->GetLoadType() == load_type) return; // If we still match, do nothing - DoCommandP(CMD_MODIFY_ORDER | CMD_MSG(STR_ERROR_CAN_T_MODIFY_THIS_ORDER), this->vehicle->tile, this->vehicle->index + (sel_ord << 20), MOF_LOAD | (load_type << 4)); + DoCommandP(CMD_MODIFY_ORDER, STR_ERROR_CAN_T_MODIFY_THIS_ORDER, this->vehicle->tile, this->vehicle->index + (sel_ord << 20), MOF_LOAD | (load_type << 4)); } /** @@ -606,7 +606,7 @@ private: if (order == nullptr) return; i = (order->GetDepotOrderType() & ODTFB_SERVICE) ? DA_ALWAYS_GO : DA_SERVICE; } - DoCommandP(CMD_MODIFY_ORDER | CMD_MSG(STR_ERROR_CAN_T_MODIFY_THIS_ORDER), this->vehicle->tile, this->vehicle->index + (sel_ord << 20), MOF_DEPOT_ACTION | (i << 4)); + DoCommandP(CMD_MODIFY_ORDER, STR_ERROR_CAN_T_MODIFY_THIS_ORDER, this->vehicle->tile, this->vehicle->index + (sel_ord << 20), MOF_DEPOT_ACTION | (i << 4)); } /** @@ -621,7 +621,7 @@ private: _settings_client.gui.new_nonstop && this->vehicle->IsGroundVehicle() ? ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS : ONSF_STOP_EVERYWHERE); order.SetDepotActionType(ODATFB_NEAREST_DEPOT); - DoCommandP(CMD_INSERT_ORDER | CMD_MSG(STR_ERROR_CAN_T_INSERT_NEW_ORDER), this->vehicle->tile, this->vehicle->index + (this->OrderGetSel() << 20), order.Pack()); + DoCommandP(CMD_INSERT_ORDER, STR_ERROR_CAN_T_INSERT_NEW_ORDER, this->vehicle->tile, this->vehicle->index + (this->OrderGetSel() << 20), order.Pack()); } /** @@ -641,7 +641,7 @@ private: } if (order->GetUnloadType() == unload_type) return; // If we still match, do nothing - DoCommandP(CMD_MODIFY_ORDER | CMD_MSG(STR_ERROR_CAN_T_MODIFY_THIS_ORDER), this->vehicle->tile, this->vehicle->index + (sel_ord << 20), MOF_UNLOAD | (unload_type << 4)); + DoCommandP(CMD_MODIFY_ORDER, STR_ERROR_CAN_T_MODIFY_THIS_ORDER, this->vehicle->tile, this->vehicle->index + (sel_ord << 20), MOF_UNLOAD | (unload_type << 4)); /* Transfer and unload orders with leave empty as default */ if (unload_type == OUFB_TRANSFER || unload_type == OUFB_UNLOAD) { @@ -669,7 +669,7 @@ private: } this->SetWidgetDirty(WID_O_NON_STOP); - DoCommandP(CMD_MODIFY_ORDER | CMD_MSG(STR_ERROR_CAN_T_MODIFY_THIS_ORDER), this->vehicle->tile, this->vehicle->index + (sel_ord << 20), MOF_NON_STOP | non_stop << 4); + DoCommandP(CMD_MODIFY_ORDER, STR_ERROR_CAN_T_MODIFY_THIS_ORDER, this->vehicle->tile, this->vehicle->index + (sel_ord << 20), MOF_NON_STOP | non_stop << 4); } /** @@ -682,7 +682,7 @@ private: if (_ctrl_pressed && this->vehicle->cur_implicit_order_index == this->OrderGetSel()) return; if (this->vehicle->GetNumOrders() <= 1) return; - DoCommandP(CMD_SKIP_TO_ORDER | CMD_MSG(_ctrl_pressed ? STR_ERROR_CAN_T_SKIP_TO_ORDER : STR_ERROR_CAN_T_SKIP_ORDER), + DoCommandP(CMD_SKIP_TO_ORDER, _ctrl_pressed ? STR_ERROR_CAN_T_SKIP_TO_ORDER : STR_ERROR_CAN_T_SKIP_ORDER, this->vehicle->tile, this->vehicle->index, _ctrl_pressed ? this->OrderGetSel() : ((this->vehicle->cur_implicit_order_index + 1) % this->vehicle->GetNumOrders())); } @@ -694,7 +694,7 @@ private: /* When networking, move one order lower */ int selected = this->selected_order + (int)_networking; - if (DoCommandP(CMD_DELETE_ORDER | CMD_MSG(STR_ERROR_CAN_T_DELETE_THIS_ORDER), this->vehicle->tile, this->vehicle->index, this->OrderGetSel())) { + if (DoCommandP(CMD_DELETE_ORDER, STR_ERROR_CAN_T_DELETE_THIS_ORDER, this->vehicle->tile, this->vehicle->index, this->OrderGetSel())) { this->selected_order = selected >= this->vehicle->GetNumOrders() ? -1 : selected; this->UpdateButtonState(); } @@ -719,7 +719,7 @@ private: /* Get another vehicle that share orders with this vehicle. */ Vehicle *other_shared = (this->vehicle->FirstShared() == this->vehicle) ? this->vehicle->NextShared() : this->vehicle->PreviousShared(); /* Copy the order list of the other vehicle. */ - if (DoCommandP(CMD_CLONE_ORDER | CMD_MSG(STR_ERROR_CAN_T_STOP_SHARING_ORDER_LIST), this->vehicle->tile, this->vehicle->index | CO_COPY << 30, other_shared->index)) { + if (DoCommandP(CMD_CLONE_ORDER, STR_ERROR_CAN_T_STOP_SHARING_ORDER_LIST, this->vehicle->tile, this->vehicle->index | CO_COPY << 30, other_shared->index)) { this->UpdateButtonState(); } } @@ -1159,7 +1159,7 @@ public: order.index = 0; order.MakeConditional(order_id); - DoCommandP(CMD_INSERT_ORDER | CMD_MSG(STR_ERROR_CAN_T_INSERT_NEW_ORDER), this->vehicle->tile, this->vehicle->index + (this->OrderGetSel() << 20), order.Pack()); + DoCommandP(CMD_INSERT_ORDER, STR_ERROR_CAN_T_INSERT_NEW_ORDER, this->vehicle->tile, this->vehicle->index + (this->OrderGetSel() << 20), order.Pack()); } ResetObjectToPlace(); break; @@ -1182,7 +1182,7 @@ public: this->selected_order = -1; } else if (sel == this->selected_order) { if (this->vehicle->type == VEH_TRAIN && sel < this->vehicle->GetNumOrders()) { - DoCommandP(CMD_MODIFY_ORDER | CMD_MSG(STR_ERROR_CAN_T_MODIFY_THIS_ORDER), + DoCommandP(CMD_MODIFY_ORDER, STR_ERROR_CAN_T_MODIFY_THIS_ORDER, this->vehicle->tile, this->vehicle->index + (sel << 20), MOF_STOP_LOCATION | ((this->vehicle->GetOrder(sel)->GetStopLocation() + 1) % OSL_END) << 4); } @@ -1331,7 +1331,7 @@ public: default: break; } - DoCommandP(CMD_MODIFY_ORDER | CMD_MSG(STR_ERROR_CAN_T_MODIFY_THIS_ORDER), this->vehicle->tile, this->vehicle->index + (sel << 20), MOF_COND_VALUE | Clamp(value, 0, 2047) << 4); + DoCommandP(CMD_MODIFY_ORDER, STR_ERROR_CAN_T_MODIFY_THIS_ORDER, this->vehicle->tile, this->vehicle->index + (sel << 20), MOF_COND_VALUE | Clamp(value, 0, 2047) << 4); } } @@ -1369,11 +1369,11 @@ public: break; case WID_O_COND_VARIABLE: - DoCommandP(CMD_MODIFY_ORDER | CMD_MSG(STR_ERROR_CAN_T_MODIFY_THIS_ORDER), this->vehicle->tile, this->vehicle->index + (this->OrderGetSel() << 20), MOF_COND_VARIABLE | index << 4); + DoCommandP(CMD_MODIFY_ORDER, STR_ERROR_CAN_T_MODIFY_THIS_ORDER, this->vehicle->tile, this->vehicle->index + (this->OrderGetSel() << 20), MOF_COND_VARIABLE | index << 4); break; case WID_O_COND_COMPARATOR: - DoCommandP(CMD_MODIFY_ORDER | CMD_MSG(STR_ERROR_CAN_T_MODIFY_THIS_ORDER), this->vehicle->tile, this->vehicle->index + (this->OrderGetSel() << 20), MOF_COND_COMPARATOR | index << 4); + DoCommandP(CMD_MODIFY_ORDER, STR_ERROR_CAN_T_MODIFY_THIS_ORDER, this->vehicle->tile, this->vehicle->index + (this->OrderGetSel() << 20), MOF_COND_COMPARATOR | index << 4); break; } } @@ -1386,7 +1386,7 @@ public: VehicleOrderID to_order = this->GetOrderFromPt(pt.y); if (!(from_order == to_order || from_order == INVALID_VEH_ORDER_ID || from_order > this->vehicle->GetNumOrders() || to_order == INVALID_VEH_ORDER_ID || to_order > this->vehicle->GetNumOrders()) && - DoCommandP(CMD_MOVE_ORDER | CMD_MSG(STR_ERROR_CAN_T_MOVE_THIS_ORDER), this->vehicle->tile, this->vehicle->index, from_order | (to_order << 16))) { + DoCommandP(CMD_MOVE_ORDER, STR_ERROR_CAN_T_MOVE_THIS_ORDER, this->vehicle->tile, this->vehicle->index, from_order | (to_order << 16))) { this->selected_order = -1; this->UpdateButtonState(); } @@ -1438,7 +1438,7 @@ public: const Order cmd = GetOrderCmdFromTile(this->vehicle, tile); if (cmd.IsType(OT_NOTHING)) return; - if (DoCommandP(CMD_INSERT_ORDER | CMD_MSG(STR_ERROR_CAN_T_INSERT_NEW_ORDER), this->vehicle->tile, this->vehicle->index + (this->OrderGetSel() << 20), cmd.Pack())) { + if (DoCommandP(CMD_INSERT_ORDER, STR_ERROR_CAN_T_INSERT_NEW_ORDER, this->vehicle->tile, this->vehicle->index + (this->OrderGetSel() << 20), cmd.Pack())) { /* With quick goto the Go To button stays active */ if (!_settings_client.gui.quick_goto) ResetObjectToPlace(); } @@ -1455,7 +1455,7 @@ public: bool share_order = _ctrl_pressed || this->goto_type == OPOS_SHARE; if (this->vehicle->GetNumOrders() != 0 && !share_order) return false; - if (DoCommandP(share_order ? CMD_CLONE_ORDER | CMD_MSG(STR_ERROR_CAN_T_SHARE_ORDER_LIST) : CMD_CLONE_ORDER | CMD_MSG(STR_ERROR_CAN_T_COPY_ORDER_LIST), + if (DoCommandP(CMD_CLONE_ORDER, share_order ? STR_ERROR_CAN_T_SHARE_ORDER_LIST : STR_ERROR_CAN_T_COPY_ORDER_LIST, this->vehicle->tile, this->vehicle->index | (share_order ? CO_SHARE : CO_COPY) << 30, v->index)) { this->selected_order = -1; ResetObjectToPlace(); |