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.
This commit is contained in:
14
src/queue.c
14
src/queue.c
@ -155,6 +155,20 @@ queue_move(struct queue *queue, unsigned from, unsigned to)
|
|||||||
queue->idToPosition[item.id] = to;
|
queue->idToPosition[item.id] = to;
|
||||||
queue->items[to] = item;
|
queue->items[to] = item;
|
||||||
queue->items[to].version = queue->version;
|
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
|
void
|
||||||
|
Reference in New Issue
Block a user