Because g_apTrack's size is determined on compile time don't allocate it dynamically but statically
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@3678 4a71c877-e1ca-e34f-864e-861f7616d084master
parent
cdb9b7bacc
commit
1513ac41e2
|
@ -18,10 +18,9 @@
|
||||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "lib/framework/frame.h"
|
|
||||||
|
|
||||||
#include "lib/framework/frameresource.h"
|
|
||||||
#include "tracklib.h"
|
#include "tracklib.h"
|
||||||
|
#include "lib/framework/frame.h"
|
||||||
|
#include "lib/framework/frameresource.h"
|
||||||
#include "audio_id.h"
|
#include "audio_id.h"
|
||||||
|
|
||||||
//*
|
//*
|
||||||
|
@ -33,7 +32,7 @@
|
||||||
//
|
//
|
||||||
// static global variables
|
// static global variables
|
||||||
// array of pointers to sound effects
|
// array of pointers to sound effects
|
||||||
static TRACK **g_apTrack;
|
static TRACK *g_apTrack[MAX_TRACKS];
|
||||||
|
|
||||||
// number of tracks loaded
|
// number of tracks loaded
|
||||||
static SDWORD g_iCurTracks = 0;
|
static SDWORD g_iCurTracks = 0;
|
||||||
|
@ -56,13 +55,7 @@ BOOL sound_Init()
|
||||||
}
|
}
|
||||||
|
|
||||||
// init audio array (with NULL pointers; which calloc ensures by setting all allocated memory to zero)
|
// init audio array (with NULL pointers; which calloc ensures by setting all allocated memory to zero)
|
||||||
g_apTrack = calloc(MAX_TRACKS, sizeof(TRACK*));
|
memset(g_apTrack, 0, sizeof(g_apTrack));
|
||||||
if (!g_apTrack)
|
|
||||||
{
|
|
||||||
debug(LOG_ERROR, "sound_Init: Out of memory");
|
|
||||||
abort();
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
// set system active flag for callbacks
|
// set system active flag for callbacks
|
||||||
g_bSystemActive = TRUE;
|
g_bSystemActive = TRUE;
|
||||||
|
@ -75,8 +68,6 @@ BOOL sound_Init()
|
||||||
//
|
//
|
||||||
BOOL sound_Shutdown( void )
|
BOOL sound_Shutdown( void )
|
||||||
{
|
{
|
||||||
free( g_apTrack );
|
|
||||||
|
|
||||||
// set inactive flag to prevent callbacks coming after shutdown
|
// set inactive flag to prevent callbacks coming after shutdown
|
||||||
g_bSystemActive = FALSE;
|
g_bSystemActive = FALSE;
|
||||||
sound_ShutdownLibrary();
|
sound_ShutdownLibrary();
|
||||||
|
|
Loading…
Reference in New Issue