From: terencehill Date: Mon, 5 Aug 2013 12:35:11 +0000 (+0200) Subject: Stop playback when removing the unique track of the playlist X-Git-Tag: xonotic-v0.8.1~157^2~10 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=2b2651b0adaec023a41438149069654a6e6c2533;p=xonotic%2Fxonotic-data.pk3dir.git Stop playback when removing the unique track of the playlist --- diff --git a/qcsrc/menu/xonotic/playlist.c b/qcsrc/menu/xonotic/playlist.c index 0127181d9..c8fce97c0 100644 --- a/qcsrc/menu/xonotic/playlist.c +++ b/qcsrc/menu/xonotic/playlist.c @@ -105,22 +105,27 @@ void XonoticPlayList_removeSelectedFromPlayList(entity me) { if(cvar("music_playlist_current0") == i) cpt = TRUE; // current playing track (we can't start next track here because startSound calls tokenize_console) - else - { - if(cvar("music_playlist_current0") > i) - cvar_set("music_playlist_current0", ftos(cvar("music_playlist_current0") - 1)); - } + else if(cvar("music_playlist_current0") > i) + cvar_set("music_playlist_current0", ftos(cvar("music_playlist_current0") - 1)); } continue; } s = strcat(s, " ", argv(i)); } + // we must stop the current playing track if it has been removed + // otherwise pause/play button will resume from another track if(s == "") + { cvar_set("music_playlist_list0", ""); + if(cpt) + me.stopSound(me); + } else - cvar_set("music_playlist_list0", substring(s, 1, strlen(s))); //remove initial space - if(cpt) - me.startSound(me, 0); // stop current playing track otherwise pause/play button will resume from another track + { + cvar_set("music_playlist_list0", substring(s, 1, strlen(s))); // remove initial space + if(cpt) + me.startSound(me, 0); + } } void PlayList_Remove(entity btn, entity me)