mirror of
https://github.com/OpenTTD/OpenTTD
synced 2026-01-20 10:52:41 +01:00
Codefix: Remove unnecessary client side checks for setting an unbunch order (#15107)
This commit is contained in:
committed by
GitHub
parent
5a906f8a30
commit
e1d90d7b69
@@ -746,9 +746,9 @@ CommandCost CmdInsertOrder(DoCommandFlags flags, VehicleID veh, VehicleOrderID s
|
||||
|
||||
/* Check if we're allowed to have a new unbunching order. */
|
||||
if (new_order.GetDepotActionType().Test(OrderDepotActionFlag::Unbunch)) {
|
||||
if (v->HasFullLoadOrder()) return CommandCost(STR_ERROR_CAN_T_ADD_ORDER, STR_ERROR_UNBUNCHING_NO_UNBUNCHING_FULL_LOAD);
|
||||
if (v->HasUnbunchingOrder()) return CommandCost(STR_ERROR_CAN_T_ADD_ORDER, STR_ERROR_UNBUNCHING_ONLY_ONE_ALLOWED);
|
||||
if (v->HasConditionalOrder()) return CommandCost(STR_ERROR_CAN_T_ADD_ORDER, STR_ERROR_UNBUNCHING_NO_UNBUNCHING_CONDITIONAL);
|
||||
if (v->HasFullLoadOrder()) return CommandCost(STR_ERROR_UNBUNCHING_NO_UNBUNCHING_FULL_LOAD);
|
||||
if (v->HasUnbunchingOrder()) return CommandCost(STR_ERROR_UNBUNCHING_ONLY_ONE_ALLOWED);
|
||||
if (v->HasConditionalOrder()) return CommandCost(STR_ERROR_UNBUNCHING_NO_UNBUNCHING_CONDITIONAL);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -375,28 +375,6 @@ static Order GetOrderCmdFromTile(const Vehicle *v, TileIndex tile)
|
||||
(_settings_client.gui.new_nonstop && v->IsGroundVehicle()) ? OrderNonStopFlag::NoIntermediate : OrderNonStopFlags{});
|
||||
|
||||
if (_ctrl_pressed) {
|
||||
/* Check to see if we are allowed to make this an unbunching order. */
|
||||
bool failed = false;
|
||||
if (v->HasFullLoadOrder()) {
|
||||
/* We don't allow unbunching if the vehicle has a full load order. */
|
||||
ShowErrorMessage(GetEncodedString(STR_ERROR_CAN_T_INSERT_NEW_ORDER), GetEncodedString(STR_ERROR_UNBUNCHING_NO_UNBUNCHING_FULL_LOAD), WL_INFO);
|
||||
failed = true;
|
||||
} else if (v->HasUnbunchingOrder()) {
|
||||
/* Don't allow a new unbunching order if we already have one. */
|
||||
ShowErrorMessage(GetEncodedString(STR_ERROR_CAN_T_INSERT_NEW_ORDER), GetEncodedString(STR_ERROR_UNBUNCHING_ONLY_ONE_ALLOWED), WL_INFO);
|
||||
failed = true;
|
||||
} else if (v->HasConditionalOrder()) {
|
||||
/* We don't allow unbunching if the vehicle has a conditional order. */
|
||||
ShowErrorMessage(GetEncodedString(STR_ERROR_CAN_T_INSERT_NEW_ORDER), GetEncodedString(STR_ERROR_UNBUNCHING_NO_UNBUNCHING_CONDITIONAL), WL_INFO);
|
||||
failed = true;
|
||||
}
|
||||
|
||||
/* Return an empty order to bail out. */
|
||||
if (failed) {
|
||||
order.Free();
|
||||
return order;
|
||||
}
|
||||
|
||||
/* Now we are allowed to set the action type. */
|
||||
order.SetDepotActionType(OrderDepotActionFlag::Unbunch);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user