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

Fix: Train running sounds should only be produced for engine parts. #12229

Merged
merged 1 commit into from
Mar 8, 2024

Conversation

PeterN
Copy link
Member

@PeterN PeterN commented Mar 8, 2024

Motivation / Problem

Train running sounds should only be produced for normal engine parts. Wagons were already excluded, but articulated parts and second multihead parts should be excluded too.

Description

Check for !IsEngine() instead of IsWagon(), as, like wagons, articulated parts and second multihead parts are not flagged as engines.

Limitations

This does not seem to be in the spec for vehicle running sounds, however it is in the code for TTDPatch, where subclass is checked to be 0:

https://github.com/ttdpatch/ttdpatch/blob/a88a0bf794ed0f085f7cd8fba682d060ab4789c9/patches/vehspri.asm#L1150

At this point is probably doesn't really matter what TTDPatch did, however this feature is seldom used, and one reason for that is that OpenTTD didn't match TTDPatch.

Checklist for review

Some things are not automated, and forgotten often. This list is a reminder for the reviewers.

  • The bug fix is important enough to be backported? (label: 'backport requested')
  • This PR touches english.txt or translations? Check the guidelines
  • This PR affects the save game format? (label 'savegame upgrade')
  • This PR affects the GS/AI API? (label 'needs review: Script API')
    • ai_changelog.hpp, game_changelog.hpp need updating.
    • The compatibility wrappers (compat_*.nut) need updating.
  • This PR affects the NewGRF API? (label 'needs review: NewGRF')

Wagons were excluded, but articulated parts and second multihead parts should be excluded too.
@michicc michicc merged commit a9de766 into OpenTTD:master Mar 8, 2024
19 checks passed
@PeterN PeterN deleted the train-running-sounds branch March 8, 2024 22:33
PeterN added a commit to PeterN/OpenTTD that referenced this pull request Apr 14, 2024
…d correctly.

OpenTTD#12229 stopped updating motion_counter for non-engine parts of trains, and in doing so accidentally followed the spec for NewGRF var 46, which breaks NewGRFs that used to... accidentally work.

Make var 46 return motion_counter of the first engine, regardless of self or parent scope. This means var 46 is always in sync with the head engine, and avoids further changes to when motion_counter is updated.
PeterN added a commit to PeterN/OpenTTD that referenced this pull request Apr 23, 2024
…arts.

NewGRFs relied on the incorrectly motion counter that was 'fixed' in OpenTTD#12229, so always update v->motion_counter for all vehicle parts.
PeterN added a commit that referenced this pull request May 17, 2024
…12561)

NewGRFs relied on the incorrectly motion counter that was 'fixed' in #12229, so always update v->motion_counter for all vehicle parts.
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

Successfully merging this pull request may close these issues.

3 participants