summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbjarni <bjarni@openttd.org>2005-01-19 01:18:29 +0000
committerbjarni <bjarni@openttd.org>2005-01-19 01:18:29 +0000
commit69065b53c868434dbdf68e5970930fe41d905a79 (patch)
tree6d64a99ebbff9fbc5292c270b2428ec8d2d2ee6c
parentf09b0def11bc81df9824ddd0c9ef98671b8ebf03 (diff)
downloadopenttd-69065b53c868434dbdf68e5970930fe41d905a79.tar.xz
(svn r1563) fix: autoreplaced trains now sets wagon override properly
-rw-r--r--vehicle.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/vehicle.c b/vehicle.c
index 4e1f9f0d9..a4cb2a08e 100644
--- a/vehicle.c
+++ b/vehicle.c
@@ -1485,6 +1485,15 @@ int32 CmdReplaceVehicle(int x, int y, uint32 flags, uint32 p1, uint32 p2)
}
}
+ // updates the id of the front engine in the other units, since the front engine just got a new engine_id
+ // this is needed for wagon override
+ if ( v->u.rail.first_engine == 0xffff && v->next != NULL ) {
+ Vehicle *veh = v->next;
+ do {
+ veh->u.rail.first_engine = new_engine_type;
+ } while ( (veh=veh->next) != NULL );
+ }
+
break;
}
case VEH_Road: