From 78b51cbec2d027a4e8f3066370d5994d4e8b0935 Mon Sep 17 00:00:00 2001 From: bjarni Date: Sat, 4 Feb 2006 18:25:07 +0000 Subject: (svn r3535) -Feature: [autoreplace] allow autoreplacing of train wagons currently ALL available wagons are displayed in the right menu in the replace window however the replacement will only be done if the new wagon can be refitted to carry same cargo as the old one is currently carrying Since the standard vehicles do not have any valid wagon replacements, this feature can only be used when using newgrf sets --- vehicle.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'vehicle.c') 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); -- cgit v1.2.3-54-g00ecf