summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryexo <yexo@openttd.org>2010-02-22 20:18:38 +0000
committeryexo <yexo@openttd.org>2010-02-22 20:18:38 +0000
commit181035181380eb460ad9a818417754181d65b2f7 (patch)
treeb45cb83a4f35485653be62899bf21222437c748f
parent945d2c08e0d642327ec2a4137938ff5aaf94ac44 (diff)
downloadopenttd-181035181380eb460ad9a818417754181d65b2f7.tar.xz
(svn r19211) -Change: allow sound sets without a sample.cat file (blathijs)
-rw-r--r--src/sound.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/sound.cpp b/src/sound.cpp
index cfdee243d..e337b5ebc 100644
--- a/src/sound.cpp
+++ b/src/sound.cpp
@@ -31,6 +31,9 @@ static void OpenBankFile(const char *filename)
{
memset(_original_sounds, 0, sizeof(_original_sounds));
+ /* If there is no sound file (nosound set), don't load anything */
+ if (filename == NULL) return;
+
FioOpenFile(SOUND_SLOT, filename);
size_t pos = FioGetPos();
uint count = FioReadDword();
@@ -162,6 +165,9 @@ static void StartSound(SoundID sound_id, int panning, uint volume)
const SoundEntry *sound = GetSound(sound_id);
if (sound == NULL) return;
+ /* Empty sound? */
+ if (sound->rate == 0) return;
+
MixerChannel *mc = MxAllocateChannel();
if (mc == NULL) return;