FS#5775 - CB32 is broken
Attached to Project:
OpenTTD
Opened by Michael Blunck (mb) - Thursday, 03 October 2013, 13:59 GMT
Last edited by frosch (frosch) - Wednesday, 13 November 2013, 14:46 GMT
Opened by Michael Blunck (mb) - Thursday, 03 October 2013, 13:59 GMT
Last edited by frosch (frosch) - Wednesday, 13 November 2013, 14:46 GMT
|
DetailsIn r25806 (and reportedly already in r25755), CB32 is broken.
It did work according to the specs still in 1.3.2 (stable), but in the latest series of nightlies bit1 is triggered for all the vehicles on the very same day (see http://www .tt-forums.net/viewtopic.php?f=68&t=68737&sid=2b951b4c8cb163b4645cebf94511904b). Since 1.3.2 (r25632) there were two suspicious commits dealing with CB32, namely r25744 and r25695. Test newGRF and savegame attached. |
This task depends upon
Closed by frosch (frosch)
Wednesday, 13 November 2013, 14:46 GMT
Reason for closing: Bug in NewGRF
Wednesday, 13 November 2013, 14:46 GMT
Reason for closing: Bug in NewGRF
I bought the 2nd train a few days later, and they nicely change colour after each other, see the attached image.
Also added my save for reference.
Since the global day counter is used as base modulo 32, if you buy vehicles at a multiple of 32 days apart, the moment of change will be the same.
In particular, vehicles bought will have the same day counter. (EDIT: "vehicles bought at the same day" is what I wanted to write there)
In normal play, users will buy vehicles at an evenly distributed modulo count, which is what the comment in the newgrf spec is about.
In the stable version (1.3.2), each wagon used to change color independently, as I described: instead, Alberth's example, when all wagons in the same consist change their color simultaneously, is a clear explanation of why CB32 is broken. Could you please fix it so that each wagon changes color independently?
- EDIT - To test this, please form a consist in which the engine and the wagons are built in different days. In the stable version, each wagon will change its color according to its own date of built, so their colors will vary in the same consist: in the nightly, all the wagons will simultaneously change color, whenever the engine's CB32 is triggered.
The recolour callback returns a recolouring depending on the duration since the last service (current-date minus last-service-date).
I believe you are misinterpreting the meaning of callback 32. It says, that returning 2 will update the recolouring.
The reverse of that statement is not true: The recolouring is not only updated when CB 32 returns 2.
In fact the recolouring is updated due to numerous other triggers (rearraging the consist, changing railtype, recently also when loading etc). In fact OTTD is free to update the recolouring whenever it likes, as long as it also does it when callback 32 triggers. If the colouring of vehicle shall not change, then the result of CB 2D must not change. CB 32 does not matter at all, it is only one trigger of many.