@@ -337,26 +337,25 @@ static CommandCost RefitVehicle(Vehicle
CommandCost cost(v->GetExpenseType(false));
uint total_capacity = 0;
uint total_mail_capacity = 0;
num_vehicles = num_vehicles == 0 ? UINT8_MAX : num_vehicles;
VehicleSet vehicles_to_refit;
if (!only_this) {
GetVehicleSet(vehicles_to_refit, v, num_vehicles);
/* In this case, we need to check the whole chain. */
v = v->First();
}
static SmallVector<RefitResult, 16> refit_result;
refit_result.clear();
std::vector<RefitResult> refit_result;
v->InvalidateNewGRFCacheOfChain();
byte actual_subtype = new_subtype;
for (; v != NULL; v = (only_this ? NULL : v->Next())) {
/* Reset actual_subtype for every new vehicle */
if (!v->IsArticulatedPart()) actual_subtype = new_subtype;
if (v->type == VEH_TRAIN && std::find(vehicles_to_refit.begin(), vehicles_to_refit.end(), v->index) == vehicles_to_refit.end() && !only_this) continue;
const Engine *e = v->GetEngine();
if (!e->CanCarryCargo()) continue;