* Change playlist position pointer by the given offset, making sure to keep it within valid range. * If the playlist is empty, position is always set to 0. * @param ofs Amount to move playlist position by. */
| 411 | * @param ofs Amount to move playlist position by. |
| 412 | */ |
| 413 | void MusicSystem::ChangePlaylistPosition(int ofs) |
| 414 | { |
| 415 | if (this->active_playlist.empty()) { |
| 416 | this->playlist_position = 0; |
| 417 | } else { |
| 418 | this->playlist_position += ofs; |
| 419 | while (this->playlist_position >= (int)this->active_playlist.size()) this->playlist_position -= (int)this->active_playlist.size(); |
| 420 | while (this->playlist_position < 0) this->playlist_position += (int)this->active_playlist.size(); |
| 421 | } |
| 422 | } |
| 423 | |
| 424 | /** |
| 425 | * Save a custom playlist to settings after modification. |