playlist: simplified setPlaylistRandomStatus()
Check the old status before assigning. This saves a temporary variable.
This commit is contained in:
parent
b084bc28ed
commit
4a510a2674
@ -1152,25 +1152,24 @@ static void randomizeOrder(int start, int end)
|
|||||||
|
|
||||||
void setPlaylistRandomStatus(bool status)
|
void setPlaylistRandomStatus(bool status)
|
||||||
{
|
{
|
||||||
bool statusWas = playlist.random;
|
if (status == playlist.random)
|
||||||
|
return;
|
||||||
|
|
||||||
playlist.random = status;
|
playlist.random = status;
|
||||||
|
|
||||||
if (status != statusWas) {
|
if (playlist.random) {
|
||||||
if (playlist.random) {
|
/*if(playlist_state==PLAYLIST_STATE_PLAY) {
|
||||||
/*if(playlist_state==PLAYLIST_STATE_PLAY) {
|
randomizeOrder(playlist.current+1,
|
||||||
randomizeOrder(playlist.current+1,
|
playlist.length-1);
|
||||||
playlist.length-1);
|
}
|
||||||
}
|
else */ randomizeOrder(0, playlist.length - 1);
|
||||||
else */ randomizeOrder(0, playlist.length - 1);
|
if (playlist.current >= 0 &&
|
||||||
if (playlist.current >= 0 &&
|
playlist.current < playlist.length) {
|
||||||
playlist.current < playlist.length) {
|
swapOrder(playlist.current, 0);
|
||||||
swapOrder(playlist.current, 0);
|
playlist.current = 0;
|
||||||
playlist.current = 0;
|
}
|
||||||
}
|
} else
|
||||||
} else
|
orderPlaylist();
|
||||||
orderPlaylist();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void previousSongInPlaylist(void)
|
void previousSongInPlaylist(void)
|
||||||
|
Loading…
Reference in New Issue
Block a user