diff options
author | Max Kellermann <max@duempel.org> | 2009-01-25 14:00:51 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2009-01-25 14:00:51 +0100 |
commit | 688880bc0b22d13321da62ae93363e4b85846f68 (patch) | |
tree | 19b48299aa2f5b42c68bc5e2ca5ecd617a371526 /src/playlist.c | |
parent | 1a59afa388874a2ceadcef2644fa9e08f0a9b828 (diff) | |
download | mpd-688880bc0b22d13321da62ae93363e4b85846f68.tar.gz mpd-688880bc0b22d13321da62ae93363e4b85846f68.tar.xz mpd-688880bc0b22d13321da62ae93363e4b85846f68.zip |
queue: added queue_shuffle_order_last()
This function shuffles the last song of a range. This is used by
addSongToPlaylist().
Diffstat (limited to 'src/playlist.c')
-rw-r--r-- | src/playlist.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/playlist.c b/src/playlist.c index 2eecc3bea..6578713db 100644 --- a/src/playlist.c +++ b/src/playlist.c @@ -442,12 +442,9 @@ addSongToPlaylist(struct song *song, unsigned *added_id) start = playlist.queued + 1; else start = playlist.current + 1; - if (start < queue_length(&playlist.queue)) { - unsigned swap = g_rand_int_range(g_rand, start, - queue_length(&playlist.queue)); - queue_swap_order(&playlist.queue, - queue_length(&playlist.queue) - 1, swap); - } + if (start < queue_length(&playlist.queue)) + queue_shuffle_order_last(&playlist.queue, start, + queue_length(&playlist.queue)); } incrPlaylistVersion(); |