mirror of
https://github.com/ZDoom/gzdoom.git
synced 2025-03-13 22:42:07 +00:00
- fixed SoundEngine::isValidSoundId.
This never accounted for linked and random sounds. It never got noticed because it never was used to validate anything essential before.
This commit is contained in:
parent
8206c29edf
commit
473221bb33
2 changed files with 8 additions and 1 deletions
|
@ -357,7 +357,7 @@ public:
|
|||
bool isValidSoundId(FSoundID sid)
|
||||
{
|
||||
int id = sid.index();
|
||||
return id > 0 && id < (int)S_sfx.Size() && !S_sfx[id].bTentative && S_sfx[id].lumpnum != sfx_empty;
|
||||
return id > 0 && id < (int)S_sfx.Size() && !S_sfx[id].bTentative && (S_sfx[id].lumpnum != sfx_empty || S_sfx[id].bRandomHeader || S_sfx[id].link != sfxinfo_t::NO_LINK);
|
||||
}
|
||||
|
||||
template<class func> bool EnumerateChannels(func callback)
|
||||
|
|
|
@ -316,9 +316,16 @@ public:
|
|||
// Returns a reference to the last element
|
||||
T &Last() const
|
||||
{
|
||||
assert(Count > 0);
|
||||
return Array[Count-1];
|
||||
}
|
||||
|
||||
T SafeGet (size_t index, const T& defaultval) const
|
||||
{
|
||||
if (index <= Count) return Array[index];
|
||||
else return defaultval;
|
||||
}
|
||||
|
||||
// returns address of first element
|
||||
T *Data() const
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue