Show specific reason why vehicle cannot be ordered to a particular station
This commit is contained in:
@@ -984,9 +984,9 @@ CommandCost CmdInsertOrderIntl(DoCommandFlag flags, Vehicle *v, VehicleOrderID s
|
||||
if (ret.Failed()) return ret;
|
||||
}
|
||||
|
||||
if (!CanVehicleUseStation(v, st)) return_cmd_error(STR_ERROR_CAN_T_ADD_ORDER);
|
||||
if (!CanVehicleUseStation(v, st)) return CommandCost::DualErrorMessage(STR_ERROR_CAN_T_ADD_ORDER, GetVehicleCannotUseStationReason(v, st));
|
||||
for (Vehicle *u = v->FirstShared(); u != nullptr; u = u->NextShared()) {
|
||||
if (!CanVehicleUseStation(u, st)) return_cmd_error(STR_ERROR_CAN_T_ADD_ORDER_SHARED);
|
||||
if (!CanVehicleUseStation(u, st)) return CommandCost::DualErrorMessage(STR_ERROR_CAN_T_ADD_ORDER_SHARED, GetVehicleCannotUseStationReason(u, st));
|
||||
}
|
||||
|
||||
/* Non stop only allowed for ground vehicles. */
|
||||
@@ -1083,7 +1083,7 @@ CommandCost CmdInsertOrderIntl(DoCommandFlag flags, Vehicle *v, VehicleOrderID s
|
||||
default: return CMD_ERROR;
|
||||
|
||||
case VEH_TRAIN: {
|
||||
if (!(wp->facilities & FACIL_TRAIN)) return_cmd_error(STR_ERROR_CAN_T_ADD_ORDER);
|
||||
if (!(wp->facilities & FACIL_TRAIN)) return CommandCost::DualErrorMessage(STR_ERROR_CAN_T_ADD_ORDER, STR_ERROR_NO_RAIL_WAYPOINT);
|
||||
|
||||
CommandCost ret = CheckInfraUsageAllowed(v->type, wp->owner);
|
||||
if (ret.Failed()) return ret;
|
||||
@@ -1091,7 +1091,7 @@ CommandCost CmdInsertOrderIntl(DoCommandFlag flags, Vehicle *v, VehicleOrderID s
|
||||
}
|
||||
|
||||
case VEH_ROAD: {
|
||||
if (!(wp->facilities & FACIL_BUS_STOP) || !(wp->facilities & FACIL_TRUCK_STOP)) return_cmd_error(STR_ERROR_CAN_T_ADD_ORDER);
|
||||
if (!(wp->facilities & FACIL_BUS_STOP) || !(wp->facilities & FACIL_TRUCK_STOP)) return CommandCost::DualErrorMessage(STR_ERROR_CAN_T_ADD_ORDER, STR_ERROR_NO_ROAD_WAYPOINT);
|
||||
|
||||
CommandCost ret = CheckInfraUsageAllowed(v->type, wp->owner);
|
||||
if (ret.Failed()) return ret;
|
||||
@@ -1099,7 +1099,7 @@ CommandCost CmdInsertOrderIntl(DoCommandFlag flags, Vehicle *v, VehicleOrderID s
|
||||
}
|
||||
|
||||
case VEH_SHIP:
|
||||
if (!(wp->facilities & FACIL_DOCK)) return_cmd_error(STR_ERROR_CAN_T_ADD_ORDER);
|
||||
if (!(wp->facilities & FACIL_DOCK)) return CommandCost::DualErrorMessage(STR_ERROR_CAN_T_ADD_ORDER, STR_ERROR_NO_BUOY);
|
||||
if (wp->owner != OWNER_NONE) {
|
||||
CommandCost ret = CheckInfraUsageAllowed(v->type, wp->owner);
|
||||
if (ret.Failed()) return ret;
|
||||
|
Reference in New Issue
Block a user