summaryrefslogtreecommitdiff
path: root/vehicle.c
diff options
context:
space:
mode:
Diffstat (limited to 'vehicle.c')
-rw-r--r--vehicle.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/vehicle.c b/vehicle.c
index ffd513a33..5d67f6200 100644
--- a/vehicle.c
+++ b/vehicle.c
@@ -1742,6 +1742,11 @@ static void MaybeReplaceVehicle(Vehicle *v)
continue;
}
+ if (w->type == VEH_Train && IsTrainWagon(w) && !CanRefitTo(EngineReplacementForPlayer(p, w->engine_type), w->cargo_type)) {
+ // we can't replace this wagon since we can't refit the new one to the right cargo type
+ continue;
+ }
+
/* Now replace the vehicle */
temp_cost = ReplaceVehicle(&w, flags);