Mercurial > hg > openttd
diff src/autoreplace_cmd.cpp @ 6735:8420208013c0 draft
(svn r9967) -Fix (r9938): autoreplace would in certain conditions move dualheaded engines in a train (usually to the rear)
-Change: moving an engine in between the two ends of a dualheaded engine will now move the rear dualheaded engine to the front of the newly added engine (instead of moving the new engine to the rear of the rear dualheaded engine)
This can make a difference if there are wagons in the train
author | bjarni <bjarni@openttd.org> |
---|---|
date | Mon, 28 May 2007 21:40:40 +0000 (2007-05-28) |
parents | 1ccff3d6924e |
children | 1faa0cbb6895 |
line wrap: on
line diff
--- a/src/autoreplace_cmd.cpp +++ b/src/autoreplace_cmd.cpp @@ -195,7 +195,10 @@ * We add the new engine after the old one instead of replacing it. It will give the same result anyway when we * sell the old engine in a moment */ + /* Get the vehicle in front of the one we move out */ Vehicle *front = GetPrevVehicleInChain(old_v); + /* If the vehicle in front is the rear end of a dualheaded engine, then we need to use the one in front of that one */ + if (IsMultiheaded(front) && !IsTrainEngine(front)) front = GetPrevVehicleInChain(front); /* Now we move the old one out of the train */ DoCommand(0, (INVALID_VEHICLE << 16) | old_v->index, 0, DC_EXEC, CMD_MOVE_RAIL_VEHICLE); /* Add the new vehicle */