Revert 229b9be7eb
and re-add with comment
This commit is contained in:
parent
69cd6640d0
commit
99051100a4
1 changed files with 6 additions and 2 deletions
|
@ -903,8 +903,12 @@ const std::string& play_controller::select_music(bool victory) const
|
|||
? (gamestate_->get_game_data()->get_victory_music().empty() ? game_config::default_victory_music : gamestate_->get_game_data()->get_victory_music())
|
||||
: (gamestate_->get_game_data()->get_defeat_music().empty() ? game_config::default_defeat_music : gamestate_->get_game_data()->get_defeat_music());
|
||||
|
||||
if(music_list.empty())
|
||||
return "";
|
||||
if(music_list.empty()) {
|
||||
// Since this function returns a reference, we can't return a temporary empty string.
|
||||
static const std::string empty_str = "";
|
||||
return empty_str;
|
||||
}
|
||||
|
||||
return music_list[randomness::rng::default_instance().get_random_int(0, music_list.size()-1)];
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue