Fixed crash caused by global sound precaching

This is a part of a4710bcdb0a40e477ce53aa4df36ec90d1402358 from master branch
https://mantis.zdoom.org/view.php?id=454
This commit is contained in:
alexey.lysiuk 2017-03-19 11:14:04 +02:00
parent a2f6ac1bb3
commit 5327deee43

View file

@ -491,14 +491,14 @@ void S_PrecacheLevel ()
actor->MarkPrecacheSounds();
}
}
for (auto i : gameinfo.PrecachedSounds)
for (auto snd : gameinfo.PrecachedSounds)
{
level.info->PrecacheSounds[i].MarkUsed();
FSoundID(snd).MarkUsed();
}
// Precache all extra sounds requested by this map.
for (i = 0; i < level.info->PrecacheSounds.Size(); ++i)
for (auto snd : level.info->PrecacheSounds)
{
level.info->PrecacheSounds[i].MarkUsed();
FSoundID(snd).MarkUsed();
}
// Don't unload sounds that are playing right now.
for (FSoundChan *chan = Channels; chan != NULL; chan = chan->NextChan)