From bbb892640f53e5dcafbf3635ab46fa7c5c88e995 Mon Sep 17 00:00:00 2001
From: terencehill <piuntn@gmail.com>
Date: Sun, 6 May 2012 01:39:58 +0200
Subject: [PATCH] If music_playlist_randomX is set randomize the starting track
 too

Signed-off-by: terencehill <piuntn@gmail.com>
---
 cd_shared.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/cd_shared.c b/cd_shared.c
index 43b4a7f4..0ae5cd59 100644
--- a/cd_shared.c
+++ b/cd_shared.c
@@ -638,14 +638,12 @@ void CDAudio_StartPlaylist(qboolean resume)
 		}
 		if (count > 0)
 		{
-			// position < 0 means never resume track
-			if (position < 0)
-				position = 0;
 			// advance to next track in playlist if the last one ended
-			if (!resume)
+			if (!resume || position < 0) // position < 0 means never resume track
 			{
 				position = 0;
-				current++;
+				if (!resume)
+					current++;
 				if (randomplay)
 					current = (int)lhrandom(0, count);
 			}
-- 
2.39.5