Fix overflow in audio code

This commit is contained in:
Sergeanur 2021-07-03 15:57:08 +03:00
parent a92dcaa0b1
commit 3ed4cdf109

View File

@ -1076,7 +1076,7 @@ void
cAudioManager::AdjustSamplesVolume() cAudioManager::AdjustSamplesVolume()
{ {
for (int i = 0; i < m_SampleRequestQueuesStatus[m_nActiveSampleQueue]; i++) { for (int i = 0; i < m_SampleRequestQueuesStatus[m_nActiveSampleQueue]; i++) {
tSound *pSample = &m_asSamples[m_nActiveSampleQueue][m_abSampleQueueIndexTable[m_nActiveSampleQueue][i] + 1]; tSound *pSample = &m_asSamples[m_nActiveSampleQueue][m_abSampleQueueIndexTable[m_nActiveSampleQueue][i]];
if (!pSample->m_bIs2D) if (!pSample->m_bIs2D)
pSample->m_nEmittingVolume = ComputeEmittingVolume(pSample->m_nEmittingVolume, pSample->m_fSoundIntensity, pSample->m_fDistance); pSample->m_nEmittingVolume = ComputeEmittingVolume(pSample->m_nEmittingVolume, pSample->m_fSoundIntensity, pSample->m_fDistance);