Fix #2602: music doesn't change immediately on loading a save

(cherry-picked from commit 94b69e0281)
This commit is contained in:
Jyrki Vesterinen 2018-06-05 08:28:12 +03:00
parent ae67350fd9
commit 097244559f
3 changed files with 10 additions and 0 deletions

View file

@ -42,6 +42,7 @@
#include "serialization/binary_or_text.hpp"
#include "serialization/parser.hpp"
#include "serialization/utf8_exception.hpp"
#include "sound.hpp"
#include "statistics.hpp"
#include "version.hpp"
#include "video.hpp"
@ -204,6 +205,8 @@ bool loadgame::load_game()
// read classification to for loading the game_config config object.
gamestate_.classification() = game_classification(load_data_.load_config);
sound::clear_current_track();
if (skip_version_check) {
return true;
}

View file

@ -576,6 +576,11 @@ void empty_playlist()
current_track_list.clear();
}
void clear_current_track()
{
current_track.reset();
}
void play_music()
{
if(!current_track) {

View file

@ -53,6 +53,8 @@ void play_music_repeatedly(const std::string& id);
void play_music_once(const std::string& id);
// Empty the playlist
void empty_playlist();
// Clear current_track, allowing immediate music changes.
void clear_current_track();
// Start playing current music.
void play_music();