summaryrefslogtreecommitdiff
path: root/vehicle.c
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2006-04-01 14:53:38 +0000
committerpeter1138 <peter1138@openttd.org>2006-04-01 14:53:38 +0000
commit96288ee39a01d12ca8fe502708eb82f4709395d3 (patch)
tree4545dd446dbe318b6c04b97878fefaaf441e6d31 /vehicle.c
parent8b1f971c1a1ca6c93894d39d56b31d4f73aefc89 (diff)
downloadopenttd-96288ee39a01d12ca8fe502708eb82f4709395d3.tar.xz
(svn r4227) - Fix: Wagon replace nows checks if the cargo types are the same before seeing if it can refit.
Diffstat (limited to 'vehicle.c')
-rw-r--r--vehicle.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/vehicle.c b/vehicle.c
index 7f5aabc20..cb7ba6a98 100644
--- a/vehicle.c
+++ b/vehicle.c
@@ -1760,9 +1760,13 @@ 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;
+ if (w->type == VEH_Train && IsTrainWagon(w)) {
+ EngineID e = EngineReplacementForPlayer(p, w->engine_type);
+
+ if (w->cargo_type != RailVehInfo(e)->cargo_type && !CanRefitTo(e, w->cargo_type)) {
+ // we can't replace this wagon since the cargo type is incorrent, and we can't refit it
+ continue;
+ }
}
/* Now replace the vehicle */