(svn r4227) - Fix: Wagon replace nows checks if the cargo types are the same before seeing if it can refit.
authorpeter1138
Sat, 01 Apr 2006 14:53:38 +0000
changeset 3412 35933e31a08f
parent 3411 0275a29a3f88
child 3413 903b3cc14bb7
(svn r4227) - Fix: Wagon replace nows checks if the cargo types are the same before seeing if it can refit.
vehicle.c
--- a/vehicle.c	Sat Apr 01 14:53:11 2006 +0000
+++ b/vehicle.c	Sat Apr 01 14:53:38 2006 +0000
@@ -1760,9 +1760,13 @@
 					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 */