Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: unpowered trailing parts of articulated engines use pax company colour #10146

Open
andythenorth opened this issue Nov 7, 2022 · 3 comments

Comments

@andythenorth
Copy link
Contributor

andythenorth commented Nov 7, 2022

Version of OpenTTD

12.2

Expected result

Trailing parts of articulated engines use company colour set by player for engine class.

Actual result

Trailing parts of articulated engines use company colour set by player for passenger coach (engine class).

Steps to reproduce

Using Iron Horse 2.61.1

Set company colours per the screenshot.

Observe that trailing parts of engines 1, 2, 6, 7 are using the pax coach colours. See note about engine 8 further down.

image

Issue does not occur in Iron Horse 2.48.0.
Bisecting shows that the issue was introduced by the following commit andythenorth/iron-horse@aebd97a

That commit brings Iron Horse into compliance with the grf spec, where power for trailing parts must be 0 (zero).
https://newgrf-specs.tt-wiki.net/wiki/Action0/Vehicles/Trains#Properties

If the power for trailing parts is non-zero, the company colour bug is not present, however that is not compliant with the grf spec. Note that setting power on trailing parts does not appear to affect the actual power used in game, which seems to depend only on lead part (although the callback may also be affecting this result).

In the screenshot, engine 8 is using the correct colour as it has a different implementation, and has power set (incorrectly) on the trailing part.

Options to solve this appear to be:

  • change the grf spec
  • change OpenTTD's implementation of articulated vehicle colour selection
  • call it a feature?
  • something else?
andythenorth added a commit to andythenorth/iron-horse that referenced this issue Nov 7, 2022
…r for trailing parts following aebd97a; set trailing unit action 0 power to 1 hp for engines, this violates the spec which requires trailing unit power to be 0, but fixes the issue; see also OpenTTD/OpenTTD#10146
andythenorth added a commit to andythenorth/iron-horse that referenced this issue Nov 7, 2022
…r for trailing parts following aebd97a; set trailing unit action 0 power to 1 hp for engines, this violates the spec which requires trailing unit power to be 0, but fixes the issue; see also OpenTTD/OpenTTD#10146
@frosch123
Copy link
Member

frosch123 commented Nov 7, 2022

The "expected behavior" is the intended behavior.
Code is here: https://github.com/OpenTTD/OpenTTD/blob/master/src/vehicle.cpp#L1892
No idea why it wouldn't work.

Oh, and the e->u.rail.railveh_type != RAILVEH_WAGON part checks for power != 0.
Not sure what this wagon-exception is about.

@JGRennison
Copy link
Contributor

https://github.com/OpenTTD/OpenTTD/blob/master/src/vehicle.cpp#L1890
(v->IsArticulatedPart() && e->u.rail.railveh_type != RAILVEH_WAGON)

Setting the power of the trailing parts to zero sets railveh_type to RAILVEH_WAGON

@frosch123
Copy link
Member

For futher reference: 336fda6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants