From: Holger Schemel Date: Sun, 28 Apr 2002 21:51:32 +0000 (+0200) Subject: rnd-20020428-3-src X-Git-Tag: 2.1.0^2~43 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=884db54d739f5838243315f390d28634cb99a7d9;p=rocksndiamonds.git rnd-20020428-3-src --- diff --git a/src/init.c b/src/init.c index ef6586f7..232f37a4 100644 --- a/src/init.c +++ b/src/init.c @@ -153,6 +153,7 @@ void InitNetworkServer() #endif } +#if 0 static void ReloadCustomSounds() { int i; @@ -161,9 +162,8 @@ static void ReloadCustomSounds() printf("DEBUG: reloading sounds '%s' ...\n", artwork.sounds_set_current); #endif - FreeAllSounds(); + LoadSoundsInfo(); - InitSoundList(NUM_SOUNDS); for(i=0; isource_filename) == 0) + { + /* The old and new sound are the same (have the same filename and path). + This usually means that this sound does not exist in this sound set + and a fallback to the existing sound is done. */ + + return; + } + + if (*snd_info) + FreeSound(*snd_info); + + *snd_info = Load_WAV(filename); } -void InitSoundList(int num_list_entries) +void InitSoundList(char *sound_name_list[], int num_list_entries) { - Sound = checked_calloc(num_list_entries * sizeof(SoundInfo *)); + if (Sound == NULL) + Sound = checked_calloc(num_list_entries * sizeof(SoundInfo *)); + + sound_name = sound_name_list; num_sounds = num_list_entries; } @@ -1227,10 +1257,7 @@ void LoadSoundToList(char *basename, int list_pos) if (Sound == NULL || list_pos >= num_sounds) return; - if (Sound[list_pos]) - FreeSound(Sound[list_pos]); - - Sound[list_pos] = LoadCustomSound(basename); + LoadCustomSound(&Sound[list_pos], basename); } static MusicInfo *Load_MOD(char *filename) @@ -1507,6 +1534,31 @@ void StopSoundExt(int nr, int method) #endif } +static void ReloadCustomSounds() +{ + int i; + +#if 1 + printf("DEBUG: reloading sounds '%s' ...\n", artwork.sounds_set_current); +#endif + + LoadSoundsInfo(); + + for(i=0; i