Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions codemp/client/cl_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1267,6 +1267,9 @@ void CL_Snd_Restart_f( void ) {

extern void S_RestartMusic( void );
S_RestartMusic();

extern void AS_ParseSets( void );
AS_ParseSets();
}


Expand Down
13 changes: 10 additions & 3 deletions codemp/client/snd_ambient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -758,13 +758,21 @@ Loads the ambient sound sets and prepares to play them when needed
-------------------------
*/

static namePrecache_m *TheNamePrecache( void )
{
// Use a static singleton so pMap persists across sound restarts.
// This fixes ambient sounds not playing after snd_restart.
static namePrecache_m singleton;
return &singleton;
}

void AS_Init( void )
{
if (!aSets)
{
numSets = 0;

pMap = new namePrecache_m;
pMap = TheNamePrecache();

//Setup the structure
aSets = new CSetGroup();
Expand Down Expand Up @@ -882,8 +890,7 @@ void AS_FreePartial(void)

numSets = 0;

delete pMap;
pMap = new namePrecache_m;
// pMap is now a static singleton, just clear it instead of delete/new
pMap->clear();
}
}
Expand Down