Baike.dev
All toolsAI codingTrendingOpen sourceNewsSubmit
Log in
Back to tool/Back to issues
#11127·OpenTTD

[Bug]: Wrong capacity in the purchase menu if train is dual headed

Author: telk5093Created Jul 11, 2023Updated Jul 25, 2026
Labelscomponent: NewGRF

Version of OpenTTD

13.3, nightly

Expected result

None capacity in the purchase menu

Actual result

image

1 (or more) capacity in the purchase menu. Especially cargo_capacity's value in the property block in NML.

Steps to reproduce

Source and grf: testgrf.zip

I have set cargo_capacity: 1; in property block and cargo_capacity: 0; in graphics block to implement livery changes as refit. (Refit is disabled and cargo_subtype is ignored if cargo capacity is zero, so I choosed this way)

I have made a sample NewGRF in NML which can reproduce this issue.

I think this issue occurs when the train uses dual_head: 1; and the capacity in the purchase menu shows the rear engine's capacity in the property block, while calculating the front engine's capacity as the value in the graphics block.

I doubt this line: https://github.com/OpenTTD/OpenTTD/blob/master/src/engine.cpp#L228

Ref: KoreanGRF/KoreanTrainSet/issues/164

Source: OpenTTD/OpenTTD

View original on GitHubView discussion on GitHub