FS#4641 - orders sometimes skipped

Attached to Project: OpenTTD
Opened by Ingo von Borstel (planetmaker) - Monday, 13 June 2011, 19:16 GMT
Last edited by frosch (frosch) - Tuesday, 14 June 2011, 19:19 GMT
Type Bug
Category Vehicles
Status Closed
Assigned To No-one
Operating System All
Severity Low
Priority Normal
Reported Version 1.1.1
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No


See the attached savegame and look at the orders of the train approaching the station. Active order is currently #8. When it decides to go to the left track of the station it suddenly jumps to order 1.
This task depends upon

Closed by  frosch (frosch)
Tuesday, 14 June 2011, 19:19 GMT
Reason for closing:  Fixed
Additional comments about closing:  in r22589
Comment by Troy_McClure (Troy_McClure) - Monday, 13 June 2011, 19:30 GMT
The oddity only seems to occur when there's a PBS (oneway or twoway) in front of the station. After removing the twoway PBS in front of the station tracks, the same problem still occurred. The oddity did NOT occur when using presignals (oneway entry signal, twoway exit signal).
Comment by frosch (frosch) - Tuesday, 14 June 2011, 18:24 GMT
VehicleOrderSaver::SwitchToNextOrder() calls UpdateOrderDest() for depot, station and waypoint-orders.

This function has the sideeffect to change the order index in two cases:
1) It is called for a service-only depot order, but the vehicle does not need service.
2) It is called for a goto-nearest-depot order, but no depot can be found.

Case 1 is cought in advance by SwitchToNextOrder(), case 2 is not.
Case 2 is triggered in this game.

This bug is present since PBS.