Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refit bug in newer versions #6521

Closed
DorpsGek opened this issue Nov 8, 2016 · 7 comments
Closed

Refit bug in newer versions #6521

DorpsGek opened this issue Nov 8, 2016 · 7 comments
Labels
flyspray This issue is imported from FlySpray (https://bugs.openttd.org/)

Comments

@DorpsGek
Copy link
Member

DorpsGek commented Nov 8, 2016

mb opened the ticket and wrote:

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.

Attachments

Reported version: trunk
Operating system: All


This issue was imported from FlySpray: https://bugs.openttd.org/task/6521
@DorpsGek
Copy link
Member Author

peter1138 wrote:

Seems to work here with old DBSetXL but the UI is slightly different.

Attachments


This comment was imported from FlySpray: https://bugs.openttd.org/task/6521#comment14361

@DorpsGek
Copy link
Member Author

mb wrote:

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.


This comment was imported from FlySpray: https://bugs.openttd.org/task/6521#comment14385

@DorpsGek
Copy link
Member Author

DorpsGek commented Apr 3, 2017

peter1138 wrote:

"sprite aligning and CB32 are still working as it should"

Meaning they are not working now?


This comment was imported from FlySpray: https://bugs.openttd.org/task/6521#comment14413

@DorpsGek
Copy link
Member Author

DorpsGek commented Apr 3, 2017

mb wrote:

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

[...]

**** 10:49 ok, "2" now basically always causes the whole consist to be recoloured ****
10:49 cb32 has a value that's specific for recoloring, I think I return that one
**** 10:49 I see. And this has changed since 1.3.2? ****
**** 10:49 yes ****
10:49 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".


This comment was imported from FlySpray: https://bugs.openttd.org/task/6521#comment14414

@DorpsGek
Copy link
Member Author

DorpsGek commented Apr 5, 2017

peter1138 wrote:

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.


This comment was imported from FlySpray: https://bugs.openttd.org/task/6521#comment14423

@DorpsGek
Copy link
Member Author

DorpsGek commented Apr 5, 2017

mb wrote:

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


This comment was imported from FlySpray: https://bugs.openttd.org/task/6521#comment14424

@DorpsGek DorpsGek added flyspray This issue is imported from FlySpray (https://bugs.openttd.org/) Vehicles labels Apr 7, 2018
@frosch123
Copy link
Member

Caches are caches, not storage.
Caches are allowed to be updated at any time.

CB32 can be used to ensure that the cache is updated at least every 32 days.
It can not be used to ensure that the cache is updated at most every 32 days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
flyspray This issue is imported from FlySpray (https://bugs.openttd.org/)
Projects
None yet
Development

No branches or pull requests

2 participants