summaryrefslogtreecommitdiff
path: root/src/sound.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/sound.cpp')
-rw-r--r--src/sound.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/sound.cpp b/src/sound.cpp
index d572050bf..f792dfdff 100644
--- a/src/sound.cpp
+++ b/src/sound.cpp
@@ -159,9 +159,18 @@ static void StartSound(SoundID sound_id, float pan, uint volume)
{
if (volume == 0) return;
- const SoundEntry *sound = GetSound(sound_id);
+ SoundEntry *sound = GetSound(sound_id);
if (sound == NULL) return;
+ /* NewGRF sound that wasn't loaded yet? */
+ if (sound->rate == 0 && sound->file_slot != 0) {
+ if (!LoadNewGRFSound(sound)) {
+ /* Mark as invalid. */
+ sound->file_slot = 0;
+ return;
+ }
+ }
+
/* Empty sound? */
if (sound->rate == 0) return;