MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / ChangePlaylistPosition

Method ChangePlaylistPosition

src/music_gui.cpp:413–422  ·  view source on GitHub ↗

* 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. */

Source from the content-addressed store, hash-verified

411 * @param ofs Amount to move playlist position by.
412 */
413void 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.

Callers 3

PlayMethod · 0.95
NextMethod · 0.95
PrevMethod · 0.95

Calls 2

emptyMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected