From 24af22bb0736a11a4fb2654570642fb66763a51f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tobias=20Gl=C3=A4=C3=9Fer?= Date: Wed, 24 Dec 2003 23:06:04 +0000 Subject: [PATCH] fixed bug / patch by Duong-Khang NGUYEN SVN-Revision: 41 --- src/sound.c | 36 ++++++++++++++---------------------- 1 file changed, 14 insertions(+), 22 deletions(-) diff --git a/src/sound.c b/src/sound.c index 666623cd4..0912015e6 100644 --- a/src/sound.c +++ b/src/sound.c @@ -52,16 +52,11 @@ Mix_Chunk * load_sound(char * file) { Mix_Chunk * snd; - if (use_sound) - { - snd = Mix_LoadWAV(file); - - if (snd == NULL) - st_abort("Can't load", file); - } - else - snd = NULL; + snd = Mix_LoadWAV(file); + if (snd == NULL) + st_abort("Can't load", file); + return(snd); } @@ -72,16 +67,11 @@ Mix_Music * load_song(char * file) { Mix_Music * sng; - if (use_sound) - { - sng = Mix_LoadMUS(file); - - if (sng == NULL) - st_abort("Can't load", file); - } - else - sng = NULL; + sng = Mix_LoadMUS(file); + if (sng == NULL) + st_abort("Can't load", file); + return (sng); } @@ -99,9 +89,10 @@ Mix_Music * load_song(char * file) void free_chunk(Mix_Chunk *chunk) { - if (use_sound) { - DEBUG_MSG( __PRETTY_FUNCTION__ ); - Mix_FreeChunk( chunk ); + if (chunk != NULL) { + DEBUG_MSG( __PRETTY_FUNCTION__ ); + Mix_FreeChunk( chunk ); + chunk = NULL; } } @@ -143,9 +134,10 @@ int play_music(Mix_Music *music, int loops) void free_music(Mix_Music *music) { - if (use_sound) { + if ( music != NULL ) { DEBUG_MSG(__PRETTY_FUNCTION__); Mix_FreeMusic( music ); + music = NULL; } } -- 2.11.0