FS#3978 - Callback 10 not run on changing railtype - potential desync.

Attached to Project: OpenTTD
Opened by David Dallaston (Pikka) - Monday, 26 July 2010, 10:53 GMT
Last edited by frosch (frosch) - Sunday, 15 August 2010, 20:00 GMT
Type Bug
Category Core
Status Closed
Assigned To No-one
Operating System All
Severity Medium
Priority Normal
Reported Version trunk
Due in Version 1.0.4
Due Date Undecided
Percent Complete 100%
Votes 0
Private No


Callback 10 (Powered wagons and visual effects) is not called when a train moves between rail types. This is a potential multiplayer desync issue.

Issue confirmed by Yexo and test grf attached - loco should smoke on non-electrified track and spark on electrified. (1.9 KiB)
This task depends upon

Closed by  frosch (frosch)
Sunday, 15 August 2010, 20:00 GMT
Reason for closing:  Fixed
Additional comments about closing:  in r20505 and previous commits
Comment by David Dallaston (Pikka) - Monday, 26 July 2010, 10:56 GMT
Additionally, someone in the know might want to update the TTDPatch wiki to say exactly when each vehicle property is updated by callback 36. At the moment it just says "most" do this, while "some" do that; very vague indeed.
Comment by Remko Bijker (Rubidium) - Tuesday, 27 July 2010, 21:03 GMT
Seems to me there is no other solution to this problem than to invalidate the complete vehicle cache. We might "optimise" this a bit by only running this once per tick if it's needed, but that only really matters when crossing a different type of track with a relatively long train.

A (semi) optimisation could be to only look at the from engine for the rail type, but that is probably bound to cause more trouble than it's worth.

NOTE: also update the track conversion method as the UpdatePower thingy has the same issue there. It should probably update it if it's not powered as a NewGRF can use the railtype regardless of its poweredness.