mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 21:02:55 +08:00
Fix corner case when shuffling.
This commit is contained in:
parent
02b903f1ea
commit
fd977cacb3
@ -243,17 +243,25 @@ namespace osu.Game.Overlays
|
||||
play(playHistory[++playHistoryIndex], true);
|
||||
else
|
||||
{
|
||||
if (playList.Count == 0) return;
|
||||
if (current != null && playList.Count == 1) return;
|
||||
//shuffle
|
||||
int j = RNG.Next(playListIndex, playList.Count);
|
||||
if (j != playListIndex)
|
||||
BeatmapInfo nextToPlay;
|
||||
do
|
||||
{
|
||||
BeatmapSetInfo temp = playList[playListIndex];
|
||||
playList[playListIndex] = playList[j];
|
||||
playList[j] = temp;
|
||||
}
|
||||
int j = RNG.Next(playListIndex, playList.Count);
|
||||
if (j != playListIndex)
|
||||
{
|
||||
BeatmapSetInfo temp = playList[playListIndex];
|
||||
playList[playListIndex] = playList[j];
|
||||
playList[j] = temp;
|
||||
}
|
||||
|
||||
nextToPlay = playList[playListIndex++].Beatmaps[0];
|
||||
if (playListIndex == playList.Count) playListIndex = 0;
|
||||
}
|
||||
while (current?.BeatmapInfo.AudioEquals(nextToPlay) == true);
|
||||
|
||||
BeatmapInfo nextToPlay = playList[playListIndex++].Beatmaps[0];
|
||||
if (playListIndex == playList.Count) playListIndex = 0;
|
||||
play(nextToPlay, true);
|
||||
appendToHistory(nextToPlay);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user