diff options
author | Max Kellermann <max@duempel.org> | 2009-02-09 22:47:23 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2009-02-09 22:47:23 +0100 |
commit | 710b3275ea09325131ca6f80cbcb98272424123d (patch) | |
tree | a51b7ea22ca87786f4f3b08fb63486268a89c6aa /src/queue.c | |
parent | bee688e99aa45f8e5e5612873471a3ff5e918578 (diff) | |
download | mpd-710b3275ea09325131ca6f80cbcb98272424123d.tar.gz mpd-710b3275ea09325131ca6f80cbcb98272424123d.tar.xz mpd-710b3275ea09325131ca6f80cbcb98272424123d.zip |
queue: update order array after song move
Commit f78cddb4 introduced a regression: after a song was moved, the
order array was not updated (in random mode). This caused MPD to
think the "current" song has changed when you moved something to the
position of the current song.
Diffstat (limited to '')
-rw-r--r-- | src/queue.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/queue.c b/src/queue.c index 73adb2f49..fc582ec29 100644 --- a/src/queue.c +++ b/src/queue.c @@ -155,6 +155,20 @@ queue_move(struct queue *queue, unsigned from, unsigned to) queue->idToPosition[item.id] = to; queue->items[to] = item; queue->items[to].version = queue->version; + + /* now deal with order */ + + if (queue->random) { + for (unsigned i = 0; i < queue->length; i++) { + if (queue->order[i] > from && queue->order[i] <= to) + queue->order[i]--; + else if (queue->order[i] < from && + queue->order[i] >= to) + queue->order[i]++; + else if (from == queue->order[i]) + queue->order[i] = to; + } + } } void |