(svn r6905) - Codechange: Copy cargo subtype when cloning vehicles.
authorpeter1138
Mon, 23 Oct 2006 16:47:20 +0000
changeset 4925 28d997934642
parent 4924 6e29520a0ba8
child 4926 f67f27fb122f
(svn r6905) - Codechange: Copy cargo subtype when cloning vehicles.
vehicle.c
--- a/vehicle.c	Mon Oct 23 16:35:27 2006 +0000
+++ b/vehicle.c	Mon Oct 23 16:47:20 2006 +0000
@@ -1828,10 +1828,10 @@
 		if (flags & DC_EXEC) {
 			w = GetVehicle(_new_vehicle_id);
 
-			if (v->cargo_type != w->cargo_type) {
+			if (v->cargo_type != w->cargo_type || v->cargo_subtype != w->cargo_subtype) {
 				// we can't pay for refitting because we can't estimate refitting costs for a vehicle before it's build
 				// if we pay for it anyway, the cost and the estimated cost will not be the same and we will have an assert
-				DoCommand(0, w->index, v->cargo_type, flags, CMD_REFIT_VEH(v->type));
+				DoCommand(0, w->index, v->cargo_type | (v->cargo_subtype << 8), flags, CMD_REFIT_VEH(v->type));
 			}
 			if (v->type == VEH_Train && HASBIT(v->u.rail.flags, VRF_REVERSE_DIRECTION)) {
 				SETBIT(w->u.rail.flags, VRF_REVERSE_DIRECTION);