diff options
author | Filip Gawin <filip.gawin@zoho.com> | 2019-06-30 23:08:06 +0200 |
---|---|---|
committer | Filip Gawin <filip.gawin@zoho.com> | 2019-07-04 01:02:00 +0200 |
commit | de4252ace8d1525b561cbb33b1fd9f7138f3263c (patch) | |
tree | 2ad8fc30e3ec15b4363c13eb9f0b1f8b6278b141 /src/audio | |
parent | SetEntityStatus (diff) | |
download | re3-de4252ace8d1525b561cbb33b1fd9f7138f3263c.tar re3-de4252ace8d1525b561cbb33b1fd9f7138f3263c.tar.gz re3-de4252ace8d1525b561cbb33b1fd9f7138f3263c.tar.bz2 re3-de4252ace8d1525b561cbb33b1fd9f7138f3263c.tar.lz re3-de4252ace8d1525b561cbb33b1fd9f7138f3263c.tar.xz re3-de4252ace8d1525b561cbb33b1fd9f7138f3263c.tar.zst re3-de4252ace8d1525b561cbb33b1fd9f7138f3263c.zip |
Diffstat (limited to 'src/audio')
-rw-r--r-- | src/audio/AudioManager.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/audio/AudioManager.cpp b/src/audio/AudioManager.cpp index 6f5e9316..606fae22 100644 --- a/src/audio/AudioManager.cpp +++ b/src/audio/AudioManager.cpp @@ -9,10 +9,12 @@ cAudioManager &AudioManager = *(cAudioManager *)0x880FC0; +constexpr int totalAudioEntities = 200; + void cAudioManager::SetEntityStatus(int32 id, bool status) { - if(m_bIsInitialised && id >= 0 && id < 200) { + if(m_bIsInitialised && id >= 0 && id < totalAudioEntities) { if(m_asAudioEntities[id].m_bIsUsed) { m_asAudioEntities[id].m_bStatus = status; } } } @@ -53,15 +55,17 @@ cAudioManager::PreTerminateGameSpecificShutdown() void cAudioManager::DestroyEntity(int32 id) { - if(m_bIsInitialised && id >= 0 && id < 200 && m_asAudioEntities[id].m_bIsUsed) { + if(m_bIsInitialised && id >= 0 && id < totalAudioEntities && + m_asAudioEntities[id].m_bIsUsed) { m_asAudioEntities[id].m_bIsUsed = 0; for(i = 0; i < m_nAudioEntitiesTotal; ++i) { if(id == m_anAudioEntityIndices[i]) { - if(i < 199) + if(i < totalAudioEntities - 1) memmove(&m_anAudioEntityIndices[i], &m_anAudioEntityIndices[i + 1], 4 * (m_nAudioEntitiesTotal - (i + 1))); - m_anAudioEntityIndices[--m_nAudioEntitiesTotal] = 200; + m_anAudioEntityIndices[--m_nAudioEntitiesTotal] = + totalAudioEntities; return; } } |