OpenTTD

Tasklist

FS#6521 - Refit bug in newer versions

Attached to Project: OpenTTD
Opened by Michael Blunck (mb) - Tuesday, 08 November 2016, 12:19 GMT
Type Bug
Category Vehicles
Status New
Assigned To No-one
Operating System All
Severity Medium
Priority Normal
Reported Version trunk
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Votes 0
Private No

Details

For newgrf development, I´m still using an older OTTD version (sprite aligning and CB32 are still working as it should) and it turns out that in recent versions "refitting to the same cargo" (using subtypes) does not work anymore, see pics.

I didn´t test in what version this first happened, since there had been a lot of changes with refitting/autorefitting.
This task depends upon

Comment by Peter Nelson (peter1138) - Sunday, 12 March 2017, 16:02 GMT
Seems to work here with old DBSetXL but the UI is slightly different.
Comment by Michael Blunck (mb) - Tuesday, 14 March 2017, 09:08 GMT
> Seems to work here with old DBSetXL but the UI is slightly different.

Yes, o/c. The UI has been changed slightly in DBXL 0.9, however "refitting to the same cargo" seems to have been changed in newer versions (-> changelogs).

Meanwhile, I´ve modified my code, to work around it.
Comment by Peter Nelson (peter1138) - Monday, 03 April 2017, 07:22 GMT
"sprite aligning and CB32 are still working as it should"

Meaning they are not working now?
Comment by Michael Blunck (mb) - Monday, 03 April 2017, 08:28 GMT
> "sprite aligning and CB32 are still working as it should"
> Meaning they are not working now?

For the sprite aligner problem see discussion here:
https://www.tt-forums.net/viewtopic.php?f=68&t=72647&sid=f9fdef5e634fceaa7eb0d748e8f7a23a


And for CB32:

----------
32-day callback (32)

This callback is called every 32 game days for each vehicle, although not for all vehicles on the same day. The callback is always used when defined, no bit in the action 0 property needs to be set to activate it.

The return value is a bit mask of the following bits:
Bit Value Meaning
0 1 Trigger vehicle trigger 10
1 2 Update colour map via callback 2D
-----------

In DBXL 0.9, and in Snail´s French Train set, a combination of CB2D and CB32 is used to "age" train vehicles, i.e. subtly changing their colour by "recolouring", *while travelling*.

Since OTTD 1.3 Beta 2 this doesn´t work anymore due to some changes by "frosch", with invalidating the colour palette, i.e. expanding de-caching, to more reasons (due to some request by George), other than "loading/starting the game or rearranging the consist", apart from CB32 (see spec above ^).

See my original bug report #5775 including a test case.

See also discussion with Snail on IRC:

----------
10:22 <Snail> I saw frosch123's comment to  FS#5775 ...
10:23 <Snail> The problem there seems to me that the recoloring procedure is somewhat broken in the new nightlies
10:23 <frosch123> it is now recoloured more often
10:23 <Snail> It also occurs when a vehicle reverses. Recoloring there is instantaneous in 1.3.2 but not anymore in the nightlies
10:23 <frosch123> there is nothing "broken" with that

[...]

**** 10:49 <frosch123> ok, "2" now basically always causes the whole consist to be recoloured ****
10:49 <Snail> cb32 has a value that's specific for recoloring, I think I return that one
**** 10:49 <Snail> I see. And this has changed since 1.3.2? ****
**** 10:49 <frosch123> yes ****
10:49 <frosch123> and for xussr requirements recolouring may be triggered even more often

http://irclogs.thegrebs.com/openttd/2013/11/13
-----------

Obviously, this is against the (original) spec, and it ruins behaviour of our sets. To come up to George´s requests (I don´t know them), this had to be done in some other way, keeping the original mechanism of CB32, e.g. by introducing some extra bit(s) for those "requirements".
Comment by Peter Nelson (peter1138) - Wednesday, 05 April 2017, 13:34 GMT
So it seems that the issue is that vehicles recolour is updating when you don't expect it. However this can always happen anyway. You need to base your recolour decision on something that won't change at the same time for all the vehicles.
Comment by Michael Blunck (mb) - Wednesday, 05 April 2017, 20:16 GMT
> So it seems that the issue is that vehicles recolour is updating when you don't expect it.
> However this can always happen anyway. You need to base your recolour decision on
> something that won't change at the same time for all the vehicles.

That´s exactly what CB32 is made for:

"This callback is called every 32 game days for each vehicle, although not for all vehicles on the same day. The callback is always used when defined, no bit in the action 0 property needs to be set to activate it.

The return value is a bit mask of the following bits:
Bit Value Meaning
0 1 Trigger vehicle trigger 10
1 2 Update colour map via callback 2D

If no bits are set, nothing happens."

And for CB2D:

"Select colour mapping for vehicle (2D)

Called while drawing the vehicle. [...]

The return value is cached to speed up sprite processing, and *only updated via callback 32 bit 1 (or when loading/starting a game or rearranging the consist)*."


Anyway, thanks for your interest.

Michael

Loading...