OpenTTD / OpenTTD

OpenTTD is an open source simulation game based upon Transport Tycoon Deluxe
https://www.openttd.org/
Other
6.21k stars 870 forks source link

[Bug]: Articulated vehicle bug #10193

Open Yozora3 opened 1 year ago

Yozora3 commented 1 year ago

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.

2TallTyler commented 1 year ago

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

PikkaBird commented 1 year ago

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

PeterN commented 1 year ago

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 commented 1 year ago

reversingisbroken

Well

2TallTyler commented 8 months ago

@Yozora3 Has this been resolved, by #10262?

Yozora3 commented 8 months ago

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

PeterN commented 8 months ago

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