Attached the game save starting one train with order one.
Let it run until the third station and it will crash.
Interesting patch. Have I missed the switch to get train reversing in stations back?

Cheers
Moderator: OpenTTD Developers
Karn wrote:Thank you for reports. I changed my mind and made a fix 0.8.2 before bigger update because those crashes are more often and serious than it initially looked. Enjoy.
That's NewGRF specific. As I mentioned before, there are many ways to define graphics for articulated vehicles. You found a NewGRF with another way. Can you tell what NewGRF is having those problems with my patch? So then I can fix the NewGRF actions that cause this.wallyweb wrote:Karn wrote:Thank you for reports. I changed my mind and made a fix 0.8.2 before bigger update because those crashes are more often and serious than it initially looked. Enjoy.![]()
The fix is in!![]()
Everything worked as intended.![]()
Well ... almost ...![]()
No crashes. Good!
The bug now is with graphics.
Bug 1:
1. Decoupled wagons turn gray when left in station.
2. When recoupled, those wagons remain gray.
3. In the depot those wagons show their true colours.
4. When leaving the depot, the wagons are gray again.
Bug 2:
1. On reversing, the articulated head end (steam engine+tender), the steam engine becomes a reversed tender, so the head end becomes (tender+reversed tender).
2. Reversing the reversed train, the head end returns to normal (steam engine+tender).
It's not array, it's double linked list. Each (part of) vehicle is node of this list and can do all the crazy stuff like checking other vehicles in chain, position in chain and anything you can think of (anything that is in NewGRF specs, there is a lot). Also each vehicle has same available variables, there is no real difference between wagons, articulated parts (if you are not NewGRF author) or engines, they have just variables set to different values. Motion is stored in every vehicle, such as everything important.wallyweb wrote:Re bug 2, I am not familiar with the internals, but I assume the train is laid out in an array and that the engine's cell governs the motion of the train and that when reversing the whole array flips, hence the need to swap graphics in the lead cell. Is this correct?
Is it possible to add some sort of variable (TRAIN_MOTION_DIRECTION ???) that is applied as a property of the array such that direction of motion can be applied without the need to flip the graphics array?
The GRF is Canadian Train Set which was coded by OzTrans who is no longer available to describe his work.Karn wrote:That's NewGRF specific. As I mentioned before, there are many ways to define graphics for articulated vehicles. You found a NewGRF with another way. Can you tell what NewGRF is having those problems with my patch? So then I can fix the NewGRF actions that cause this.wallyweb wrote:Bug 2:
1. On reversing, the articulated head end (steam engine+tender), the steam engine becomes a reversed tender, so the head end becomes (tender+reversed tender).
2. Reversing the reversed train, the head end returns to normal (steam engine+tender).
There are ancient ways to code articulated vehicles, which coders had to use e.g. before implementation of "position within articulated vehicle" (var 4D).wallyweb wrote: GRF is Canadian Train Set which was coded by OzTrans [...]
I switched to NARS which graphically is the closest to the Canadian train set and it worked perfectly.wallyweb wrote:The GRF is Canadian Train Set which was coded by OzTrans who is no longer available to describe his work.Karn wrote:That's NewGRF specific. As I mentioned before, there are many ways to define graphics for articulated vehicles. You found a NewGRF with another way. Can you tell what NewGRF is having those problems with my patch? So then I can fix the NewGRF actions that cause this.wallyweb wrote:Bug 2:
1. On reversing, the articulated head end (steam engine+tender), the steam engine becomes a reversed tender, so the head end becomes (tender+reversed tender).
2. Reversing the reversed train, the head end returns to normal (steam engine+tender).
I'll test with some other sets to get some comparisons.
Thanks.
Has anyone tested with BRTrains. In that set each “wagon” is individually coded for livery. I would assume that in that case the details of the vehicles are maintained?Snail wrote:Ok, so I've found another bug (or, at least, an undesirable patch behavior). Let me precise I'm still using version 0.8 .
Background: my set uses the "property" callback (CB36) a lot, as well as the "recoloring" callback, in order to change properties (capacity, length, weight etc), recoloring scheme, and graphics of the wagons, according to the engine they're attached to.
It looks like this structure is not very well compatible with this otherwise wonderful patch.
My actions to reproduce this bug, and its effects, are the following:
1.
I create a consist pulled by a specific steamer, with three different types of wagons (a mail van, a mixed mail/passenger coach, and a passenger coach).
When pulled by this steamer, the first vehicle I mentioned will have its length shrunk from 4/8 to 3/8; the second vehicle, which is actually articulated and made of 3 parts, will be stretched from 4/8 to 6/8 length. All the vehicles will see their properties slightly change, in terms of capacity for example, as well as their graphics and recoloring (they will be recolored in brown, while a default wagon is recolored in green).
This is the initial stage, before reversing:
bug 20180718 0.png
2.
When this consist reaches the end of line, the patch reverses it. However, perhaps due to the changes in length occurred through CB36, I'm getting this error message (I actually get it twice, most likely because there are two vehicles -the mail van and the mixed coach- whose lengths changed):
bug 20180718 1.png
3.
Once the consist runs in reverse, all the changes to the coaches I made through CB36 are lost! Each coach reverts back to its default state. Even when the train reaches the depot, the in-depot view remains wrong.
bug 20180718 2.png
It looks like that, when reversing a train, this patch flips all vehicles, so that the original engine is not the first vehicle in the consist anymore; therefore, CB36 and the other callbacks will lose their hook (I technically use the "engine()" syntax in m4nfo to link to the engine).
This is the same problem I saw when decoupling. Perhaps we should find a way for each vehicle to keep its characteristics as of when it left the depot, even after reversing or decoupling. I know that probably, if I avoided using CB36 like this, the issues would go away, but that's not really realistic (I couldn't achieve half of what I want without it).
Karn, please feel free to ask me any further questions if you need extra info. I could even send you the GRF I used for this.
I can see your reasoning ...ic111 wrote:...
this is exactly what i was talking about earlier in the thread (or maybe the previous thread), the use of CB36 is essentially incompatible with any shunting ability.Snail wrote:Ok, so I've found another bug (or, at least, an undesirable patch behavior). Let me precise I'm still using version 0.8 .
Background: my set uses the "property" callback (CB36) a lot, as well as the "recoloring" callback, in order to change properties (capacity, length, weight etc), recoloring scheme, and graphics of the wagons, according to the engine they're attached to.
It looks like this structure is not very well compatible with this otherwise wonderful patch.
My point here was, that this doesn't only affect shunting. It also affects reversing, because the order of the vehicles is swapped, even if the original engine is still present in the consist.Eddi wrote:this is exactly what i was talking about earlier in the thread (or maybe the previous thread), the use of CB36 is essentially incompatible with any shunting ability.Snail wrote:Ok, so I've found another bug (or, at least, an undesirable patch behavior). Let me precise I'm still using version 0.8 .
Background: my set uses the "property" callback (CB36) a lot, as well as the "recoloring" callback, in order to change properties (capacity, length, weight etc), recoloring scheme, and graphics of the wagons, according to the engine they're attached to.
It looks like this structure is not very well compatible with this otherwise wonderful patch.
there are basically 2 ways out of this:
- Disable shunting if CB36 indicates a change in capacity. this is not very desirable, but at least the game won't break.
- somehow make a "ghost" version of the original front engine, and allow NewGRFs to access that. this will get complicated very quickly, like what happens if the front engine gets sold while the wagons are still out there somewhere?
There are always more options. There is c) Update CB36 or part of it less often (only in depot arranging?) and move the part not compatible with shunting from cache to permanent variable.Eddi wrote:this is exactly what i was talking about earlier in the thread (or maybe the previous thread), the use of CB36 is essentially incompatible with any shunting ability.Snail wrote:Ok, so I've found another bug (or, at least, an undesirable patch behavior). Let me precise I'm still using version 0.8 .
Background: my set uses the "property" callback (CB36) a lot, as well as the "recoloring" callback, in order to change properties (capacity, length, weight etc), recoloring scheme, and graphics of the wagons, according to the engine they're attached to.
It looks like this structure is not very well compatible with this otherwise wonderful patch.
there are basically 2 ways out of this:
- Disable shunting if CB36 indicates a change in capacity. this is not very desirable, but at least the game won't break.
- somehow make a "ghost" version of the original front engine, and allow NewGRFs to access that. this will get complicated very quickly, like what happens if the front engine gets sold while the wagons are still out there somewhere?
This problem exists already now, without that shunting feature, for wagons in depot.Eddi wrote: [...] what happens if the front engine gets sold while the wagons are still out there somewhere?
This is not an option, because CB36 is also evaluated on loading a savegame, and it must at that point always return the same values as previously in the Depot. If you want to change that, you have to dig through a whole lot of cached values, and put them in the savegame.Karn wrote:There is c) Update CB36 or part of it less often (only in depot arranging?) and move the part not compatible with shunting from cache to permanent variable.
But it's far less of a problem while inside a depot.michael blunck wrote:This problem exists already now, without that shunting feature, for wagons in depot.Eddi wrote: [...] what happens if the front engine gets sold while the wagons are still out there somewhere?
You are quite wrong. CB36 is not the problem, it's consequence. CB36 itself does nothing. It's depended on varaction 2.Eddi wrote:This is not an option, because CB36 is also evaluated on loading a savegame, and it must at that point always return the same values as previously in the Depot. If you want to change that, you have to dig through a whole lot of cached values, and put them in the savegame.Karn wrote:There is c) Update CB36 or part of it less often (only in depot arranging?) and move the part not compatible with shunting from cache to permanent variable.
Users browsing this forum: No registered users and 8 guests