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

Method SetPositionBySetIndex

src/music_gui.cpp:187–191  ·  view source on GitHub ↗

* Set playlist position by set index. * @param set_index Set index to select. */

Source from the content-addressed store, hash-verified

185 * @param set_index Set index to select.
186 */
187void MusicSystem::SetPositionBySetIndex(uint set_index)
188{
189 auto it = std::ranges::find(this->active_playlist, set_index, &PlaylistEntry::set_index);
190 if (it != std::end(this->active_playlist)) this->playlist_position = std::distance(std::begin(this->active_playlist), it);
191}
192
193/**
194 * Get set index from current playlist position.

Callers 2

ShuffleMethod · 0.95
UnshuffleMethod · 0.95

Calls 3

findFunction · 0.50
endFunction · 0.50
beginFunction · 0.50

Tested by

no test coverage detected