From 7bbf3809318a736de7946e8b6a81a3d82a01b2cf Mon Sep 17 00:00:00 2001 From: Peter Nelson Date: Sun, 27 Apr 2025 16:20:38 +0100 Subject: [PATCH] Fix #14125, 828e808444: NewGRF sounds were not loaded. (#14130) NewGRF Action 11 should be handled in both INIT and ACTIVATION stages for sounds to be loaded. Additionally the Action 0 feature test failed due to offsets involved. --- src/newgrf/newgrf_act0_sounds.cpp | 1 + src/newgrf/newgrf_act11.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/newgrf/newgrf_act0_sounds.cpp b/src/newgrf/newgrf_act0_sounds.cpp index 7f5c5300e6..a80699d41d 100644 --- a/src/newgrf/newgrf_act0_sounds.cpp +++ b/src/newgrf/newgrf_act0_sounds.cpp @@ -26,6 +26,7 @@ static ChangeInfoResult SoundEffectChangeInfo(uint first, uint last, int prop, ByteReader &buf) { ChangeInfoResult ret = CIR_SUCCESS; + if (first == last) return ret; if (_cur_gps.grffile->sound_offset == 0) { GrfMsg(1, "SoundEffectChangeInfo: No effects defined, skipping"); diff --git a/src/newgrf/newgrf_act11.cpp b/src/newgrf/newgrf_act11.cpp index fd1dc38029..e923fcfe28 100644 --- a/src/newgrf/newgrf_act11.cpp +++ b/src/newgrf/newgrf_act11.cpp @@ -175,6 +175,6 @@ static void SkipAct11(ByteReader &buf) template <> void GrfActionHandler<0x11>::FileScan(ByteReader &buf) { SkipAct11(buf); } template <> void GrfActionHandler<0x11>::SafetyScan(ByteReader &buf) { GRFUnsafe(buf); } template <> void GrfActionHandler<0x11>::LabelScan(ByteReader &buf) { SkipAct11(buf); } -template <> void GrfActionHandler<0x11>::Init(ByteReader &buf) { SkipAct11(buf); } +template <> void GrfActionHandler<0x11>::Init(ByteReader &buf) { GRFSound(buf); } template <> void GrfActionHandler<0x11>::Reserve(ByteReader &buf) { SkipAct11(buf); } template <> void GrfActionHandler<0x11>::Activation(ByteReader &buf) { GRFSound(buf); }