OpenTTD icon indicating copy to clipboard operation
OpenTTD copied to clipboard

[Bug]: Articulated vehicle bug

Open Yozora3 opened this issue 2 years ago • 7 comments

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

  1. Load the savegame with provided GRF file
  2. 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.

Yozora3 avatar Nov 25 '22 15:11 Yozora3

Link to NewGRF source code: https://github.com/Yozora3/JPplusMetro

2TallTyler avatar Nov 25 '22 16:11 2TallTyler

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).

boxjump

PikkaBird avatar Nov 25 '22 16:11 PikkaBird

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.

PeterN avatar Nov 29 '22 22:11 PeterN

reversingisbroken

Well

PeterN avatar Nov 29 '22 22:11 PeterN

@Yozora3 Has this been resolved, by #10262?

2TallTyler avatar Dec 24 '23 00:12 2TallTyler

Seems like it has not. 1+8+1 still shifts on reverse image

Yozora3 avatar Dec 24 '23 08:12 Yozora3

Indeed, #10262 does not attempt to address this issue.

PeterN avatar Dec 24 '23 12:12 PeterN