OpenTTD
OpenTTD copied to clipboard
[Bug]: Articulated vehicle bug
Version of OpenTTD
12.2
Expected result
Articulated train-car of 1+6+1 length should reverse normally
Savegame: Articulated_vehicle_bug.zip GRF and sourcefile: https://github.com/Yozora3/JPplusMetro
Actual result
When articulated train-car of 1+6+1 length is reversed, bounding box flips, causing the graphical bug
Steps to reproduce
- Load the savegame with provided GRF file
- Reverse the train on the exact position
Possible causes
Pruple I can confirm that in the grf posted the bounding boxes move when reversing the train... happens with vehicles from some other grfs too, with certain train vehicle combinations. Yozora I have another articulated train with 1+7+1 combination that works perfect Pruple does it depend on the length of the train? Yozora I think it's connected to odd\even numbers of the middle articulated section With developer tools I can see that 1+7+1 bounding box is in the middle, while 1+6+1 the position changes with direction of the train Pruple there's definitely some rounding error with certain combinations of vehicle lengths and how it calculates where to position the other end of the consist when reversing. 6-6-8 jumps, 6-8-6 doesn't.
Link to NewGRF source code: https://github.com/Yozora3/JPplusMetro
There's definitely some rounding error with certain combinations of vehicle lengths and how it calculates where to position the other end of the consist when reversing - this is not limited to articulated vehicles. 6-6-8 jumps, 6-8-6 doesn't (see image, note position of bounding box end relative to the end of the track).
I've also got a combo that shifts 2 internal units when you reverse it, nice.
It's also possible to leave a 1.1 length train on a 1 length track.
Well
@Yozora3 Has this been resolved, by #10262?
Seems like it has not.
1+8+1 still shifts on reverse
Indeed, #10262 does not attempt to address this issue.