train_cmd.c
changeset 491 0642006d876c
parent 445 0e3fa3da3899
child 495 bfc16f011bb7
--- a/train_cmd.c	Mon Nov 22 22:52:01 2004 +0000
+++ b/train_cmd.c	Mon Nov 22 23:05:34 2004 +0000
@@ -1037,7 +1037,12 @@
 	num = 0;
 
 	do {
-		if (!(_rail_vehicle_info[v->engine_type].flags & RVI_WAGON) && (byte)p2 != v->cargo_type && v->cargo_cap != 0) {
+		/* XXX: We also refit all the attached wagons en-masse if they
+		 * can be refitted. This is how TTDPatch does it.  TODO: Have
+		 * some nice [Refit] button near each wagon. --pasky */
+		if ((!(_rail_vehicle_info[v->engine_type].flags & RVI_WAGON)
+		     || (_engine_refit_masks[v->engine_type] & (1 << p2)))
+		    && (byte) p2 != v->cargo_type && v->cargo_cap != 0) {
 			cost += (_price.build_railvehicle >> 8);
 			num += v->cargo_cap;
 			if (flags & DC_EXEC) {