From 81b7373637e4b0c5c961b31c64ada8ed2a84d3a2 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 18 Oct 2017 08:46:31 +0200 Subject: [PATCH] queue/Queue: MoveOrder() returns to_order --- src/queue/Playlist.cxx | 3 +-- src/queue/Queue.cxx | 3 ++- src/queue/Queue.hxx | 4 +++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/queue/Playlist.cxx b/src/queue/Playlist.cxx index 667e3457f..dfeb0d163 100644 --- a/src/queue/Playlist.cxx +++ b/src/queue/Playlist.cxx @@ -310,8 +310,7 @@ playlist::SetRandom(PlayerControl &pc, bool status) playlist is played after that */ unsigned current_order = queue.PositionToOrder(current_position); - queue.MoveOrder(current_order, 0); - current = 0; + current = queue.MoveOrder(current_order, 0); } else current = -1; } else diff --git a/src/queue/Queue.cxx b/src/queue/Queue.cxx index d248f306b..9ee9568e0 100644 --- a/src/queue/Queue.cxx +++ b/src/queue/Queue.cxx @@ -195,7 +195,7 @@ Queue::MoveRange(unsigned start, unsigned end, unsigned to) noexcept } } -void +unsigned Queue::MoveOrder(unsigned from_order, unsigned to_order) noexcept { assert(from_order < length); @@ -212,6 +212,7 @@ Queue::MoveOrder(unsigned from_order, unsigned to_order) noexcept } order[to_order] = from_position; + return to_order; } void diff --git a/src/queue/Queue.hxx b/src/queue/Queue.hxx index bd2f95c1a..b9ca341e4 100644 --- a/src/queue/Queue.hxx +++ b/src/queue/Queue.hxx @@ -284,8 +284,10 @@ struct Queue { /** * Moves a song to a new position in the "order" list. + * + * @return to_order */ - void MoveOrder(unsigned from_order, unsigned to_order) noexcept; + unsigned MoveOrder(unsigned from_order, unsigned to_order) noexcept; /** * Moves a song to a new position.