(svn r23882) -Codechange: Delay parsing of NewGRF sound effects until first usage.

This commit is contained in:
michi_cc
2012-02-04 13:28:44 +00:00
parent 949d2d3b55
commit ee5e3a0482
4 changed files with 176 additions and 160 deletions

View File

@@ -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;