Skip to content

Commit f3e8ce5

Browse files
committed
Fixed memory leaks into engine_sound.emit_sound caused by the sounds not being emitted through the reliable channel.
1 parent 0c4248e commit f3e8ce5

6 files changed

Lines changed: 24 additions & 12 deletions

File tree

src/core/modules/engines/blade/engines.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
// Includes.
3232
//-----------------------------------------------------------------------------
3333
#include "engine/IEngineSound.h"
34+
#include "modules/filters/filters_recipients.h"
3435

3536

3637
//-----------------------------------------------------------------------------
@@ -57,7 +58,7 @@ class GameIVEngineServerExt
5758
class IEngineSoundExt
5859
{
5960
public:
60-
static void EmitSound(IEngineSound* pEngineSound, IRecipientFilter& filter, int iEntIndex, int iChannel, const char *pSample,
61+
static void EmitSound(IEngineSound* pEngineSound, MRecipientFilter& filter, int iEntIndex, int iChannel, const char *pSample,
6162
float flVolume, float flAttenuation, int iFlags, int iPitch, const Vector *pOrigin, const Vector *pDirection,
6263
tuple origins, bool bUpdatePositions, float soundtime, int speakerentity)
6364
{
@@ -71,7 +72,8 @@ class IEngineSoundExt
7172
vecOrigins.AddToTail(extract<Vector>(origins[i]));
7273
}
7374
}
74-
75+
76+
filter.m_bReliable = true;
7577
pEngineSound->EmitSound(filter, iEntIndex, iChannel, pSample, -1, pSample, flVolume, flAttenuation, 0, iFlags, iPitch, pOrigin, pDirection,
7678
pUtlVecOrigins, bUpdatePositions, soundtime, speakerentity);
7779
}

src/core/modules/engines/bms/engines.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
// Includes.
3232
//-----------------------------------------------------------------------------
3333
#include "engine/IEngineSound.h"
34+
#include "modules/filters/filters_recipients.h"
3435

3536

3637
//-----------------------------------------------------------------------------
@@ -57,7 +58,7 @@ class GameIVEngineServerExt
5758
class IEngineSoundExt
5859
{
5960
public:
60-
static void EmitSound(IEngineSound* pEngineSound, IRecipientFilter& filter, int iEntIndex, int iChannel, const char *pSample,
61+
static void EmitSound(IEngineSound* pEngineSound, MRecipientFilter& filter, int iEntIndex, int iChannel, const char *pSample,
6162
float flVolume, float flAttenuation, int iFlags, int iPitch, const Vector *pOrigin, const Vector *pDirection,
6263
tuple origins, bool bUpdatePositions, float soundtime, int speakerentity)
6364
{
@@ -71,7 +72,8 @@ class IEngineSoundExt
7172
vecOrigins.AddToTail(extract<Vector>(origins[i]));
7273
}
7374
}
74-
75+
76+
filter.m_bReliable = true;
7577
pEngineSound->EmitSound(filter, iEntIndex, iChannel, pSample, flVolume, flAttenuation, iFlags, iPitch, 0, pOrigin,
7678
pDirection, pUtlVecOrigins, bUpdatePositions, soundtime, speakerentity);
7779
}

src/core/modules/engines/csgo/engines.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
// Includes.
3232
//-----------------------------------------------------------------------------
3333
#include "engine/IEngineSound.h"
34+
#include "modules/filters/filters_recipients.h"
3435

3536

3637
//-----------------------------------------------------------------------------
@@ -57,7 +58,7 @@ class GameIVEngineServerExt
5758
class IEngineSoundExt
5859
{
5960
public:
60-
static void EmitSound(IEngineSound* pEngineSound, IRecipientFilter& filter, int iEntIndex, int iChannel, const char *pSample,
61+
static void EmitSound(IEngineSound* pEngineSound, MRecipientFilter& filter, int iEntIndex, int iChannel, const char *pSample,
6162
float flVolume, float flAttenuation, int iFlags, int iPitch, const Vector *pOrigin, const Vector *pDirection,
6263
tuple origins, bool bUpdatePositions, float soundtime, int speakerentity)
6364
{
@@ -71,7 +72,8 @@ class IEngineSoundExt
7172
vecOrigins.AddToTail(extract<Vector>(origins[i]));
7273
}
7374
}
74-
75+
76+
filter.m_bReliable = true;
7577
pEngineSound->EmitSound(filter, iEntIndex, iChannel, pSample, -1, pSample, flVolume, flAttenuation, 0, iFlags, iPitch, pOrigin, pDirection,
7678
pUtlVecOrigins, bUpdatePositions, soundtime, speakerentity);
7779
}

src/core/modules/engines/gmod/engines.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
// Includes.
3232
//-----------------------------------------------------------------------------
3333
#include "engine/IEngineSound.h"
34+
#include "modules/filters/filters_recipients.h"
3435

3536

3637
//-----------------------------------------------------------------------------
@@ -57,7 +58,7 @@ class GameIVEngineServerExt
5758
class IEngineSoundExt
5859
{
5960
public:
60-
static void EmitSound(IEngineSound* pEngineSound, IRecipientFilter& filter, int iEntIndex, int iChannel, const char *pSample,
61+
static void EmitSound(IEngineSound* pEngineSound, MRecipientFilter& filter, int iEntIndex, int iChannel, const char *pSample,
6162
float flVolume, float flAttenuation, int iFlags, int iPitch, const Vector *pOrigin, const Vector *pDirection,
6263
tuple origins, bool bUpdatePositions, float soundtime, int speakerentity)
6364
{
@@ -71,7 +72,8 @@ class IEngineSoundExt
7172
vecOrigins.AddToTail(extract<Vector>(origins[i]));
7273
}
7374
}
74-
75+
76+
filter.m_bReliable = true;
7577
pEngineSound->EmitSound(filter, iEntIndex, iChannel, pSample, flVolume, flAttenuation, iFlags, iPitch, 0, pOrigin, pDirection,
7678
pUtlVecOrigins, bUpdatePositions, soundtime, speakerentity);
7779
}

src/core/modules/engines/l4d2/engines.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
// Includes.
3232
//-----------------------------------------------------------------------------
3333
#include "engine/IEngineSound.h"
34+
#include "modules/filters/filters_recipients.h"
3435

3536

3637
//-----------------------------------------------------------------------------
@@ -57,7 +58,7 @@ class GameIVEngineServerExt
5758
class IEngineSoundExt
5859
{
5960
public:
60-
static void EmitSound(IEngineSound* pEngineSound, IRecipientFilter& filter, int iEntIndex, int iChannel, const char *pSample,
61+
static void EmitSound(IEngineSound* pEngineSound, MRecipientFilter& filter, int iEntIndex, int iChannel, const char *pSample,
6162
float flVolume, float flAttenuation, int iFlags, int iPitch, const Vector *pOrigin, const Vector *pDirection,
6263
tuple origins, bool bUpdatePositions, float soundtime, int speakerentity)
6364
{
@@ -71,7 +72,8 @@ class IEngineSoundExt
7172
vecOrigins.AddToTail(extract<Vector>(origins[i]));
7273
}
7374
}
74-
75+
76+
filter.m_bReliable = true;
7577
pEngineSound->EmitSound(filter, iEntIndex, iChannel, pSample, flVolume, flAttenuation, iFlags, iPitch, pOrigin,
7678
pDirection, pUtlVecOrigins, bUpdatePositions, soundtime, speakerentity);
7779
}

src/core/modules/engines/orangebox/engines.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
//-----------------------------------------------------------------------------
3333
#include "engine/IEngineSound.h"
3434
#include "eiface.h"
35+
#include "modules/filters/filters_recipients.h"
3536

3637

3738
//-----------------------------------------------------------------------------
@@ -63,7 +64,7 @@ class GameIVEngineServerExt
6364
class IEngineSoundExt
6465
{
6566
public:
66-
static void EmitSound(IEngineSound* pEngineSound, IRecipientFilter& filter, int iEntIndex, int iChannel, const char *pSample,
67+
static void EmitSound(IEngineSound* pEngineSound, MRecipientFilter& filter, int iEntIndex, int iChannel, const char *pSample,
6768
float flVolume, float flAttenuation, int iFlags, int iPitch, const Vector *pOrigin, const Vector *pDirection,
6869
tuple origins, bool bUpdatePositions, float soundtime, int speakerentity)
6970
{
@@ -77,7 +78,8 @@ class IEngineSoundExt
7778
vecOrigins.AddToTail(extract<Vector>(origins[i]));
7879
}
7980
}
80-
81+
82+
filter.m_bReliable = true;
8183
pEngineSound->EmitSound(filter, iEntIndex, iChannel, pSample, flVolume, flAttenuation, iFlags, iPitch, 0, pOrigin,
8284
pDirection, pUtlVecOrigins, bUpdatePositions, soundtime, speakerentity);
8385
}

0 commit comments

Comments
 (0)