diff -r 010ec2fa7d7b -r bced12412f94 hedgewars/uSound.pas --- a/hedgewars/uSound.pas Wed Nov 30 12:19:10 2011 +0100 +++ b/hedgewars/uSound.pas Wed Nov 30 23:16:44 2011 +0100 @@ -52,6 +52,7 @@ procedure PauseMusic; procedure ResumeMusic; procedure ChangeMusic; // Replaces music track with current MusicFN and plays it. +procedure StopMusic; // Stops and releases the current track // SOUNDS @@ -458,7 +459,8 @@ if (MusicFN = '') or (not isMusicEnabled) then exit; - Mix_PauseMusic(Mus); + if Mus <> nil then + Mix_PauseMusic(Mus); end; procedure ResumeMusic; @@ -466,7 +468,8 @@ if (MusicFN = '') or (not isMusicEnabled) then exit; - Mix_ResumeMusic(Mus); + if Mus <> nil then + Mix_ResumeMusic(Mus); end; procedure ChangeMusic; @@ -474,11 +477,17 @@ if (MusicFN = '') or (not isMusicEnabled) then exit; - // get rid of current music + StopMusic; + PlayMusic; +end; + +procedure StopMusic; +begin + if (MusicFN = '') or (not isMusicEnabled) then + exit; + if Mus <> nil then Mix_FreeMusic(Mus); - - PlayMusic; end; procedure chVoicepack(var s: shortstring);