|
|
|
@ -458,17 +458,15 @@ CommandCost CmdRefitVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, uint
|
|
|
|
|
|
|
|
|
|
/* Allow auto-refitting only during loading and normal refitting only in a depot. */
|
|
|
|
|
if (!is_virtual_train) {
|
|
|
|
|
if (!free_wagon && (!auto_refit || !front->current_order.IsType(OT_LOADING)) && !front->IsStoppedInDepot()) {
|
|
|
|
|
if ((flags & DC_QUERY_COST) == 0 && // used by the refit GUI, including the order refit GUI.
|
|
|
|
|
!free_wagon && // used by autoreplace/renew
|
|
|
|
|
(!auto_refit || !front->current_order.IsType(OT_LOADING)) && // refit inside stations
|
|
|
|
|
!front->IsStoppedInDepot()) { // refit inside depots
|
|
|
|
|
return_cmd_error(STR_ERROR_TRAIN_MUST_BE_STOPPED_INSIDE_DEPOT + front->type);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (front->vehstatus & VS_CRASHED) return_cmd_error(STR_ERROR_VEHICLE_IS_DESTROYED);
|
|
|
|
|
}
|
|
|
|
|
if ((flags & DC_QUERY_COST) == 0 && // used by the refit GUI, including the order refit GUI.
|
|
|
|
|
!free_wagon && // used by autoreplace/renew
|
|
|
|
|
(!auto_refit || !front->current_order.IsType(OT_LOADING)) && // refit inside stations
|
|
|
|
|
!front->IsStoppedInDepot()) { // refit inside depots
|
|
|
|
|
return_cmd_error(STR_ERROR_TRAIN_MUST_BE_STOPPED_INSIDE_DEPOT + front->type);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (front->vehstatus & VS_CRASHED) return_cmd_error(STR_ERROR_VEHICLE_IS_DESTROYED);
|
|
|
|
|
|
|
|
|
|