Skip to content

Commit

Permalink
Use std::find when checking for duplicate tracks
Browse files Browse the repository at this point in the history
  • Loading branch information
CelticMinstrel committed Apr 24, 2017
1 parent a0c860c commit 6db0d10
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions src/sound.cpp
Expand Up @@ -602,13 +602,7 @@ void play_music_config(const config &music_node, int i)
// Avoid 2 tracks with the same name, since that can cause an infinite loop
// in choose_track(), 2 tracks with the same name will always return the
// current track and track_ok() doesn't allow that.
std::vector<music_track>::const_iterator itor = current_track_list.begin();
while(itor != current_track_list.end()) {
if(track == *itor) break;
++itor;
}

if(itor == current_track_list.end()) {
if(std::find(current_track_list.begin(), current_track_list.end(), track) == current_track_list.end()) {
if(i < 0 || static_cast<size_t>(i) >= current_track_list.size()) {
current_track_list.push_back(track);
} else {
Expand Down

0 comments on commit 6db0d10

Please sign in to comment.