Skip to content

Commit

Permalink
Commit music changes only after event completes, not after any contro…
Browse files Browse the repository at this point in the history
…l=flow tag is executed
  • Loading branch information
CelticMinstrel committed Apr 24, 2017
1 parent 6e2c065 commit 5b79669
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 0 additions & 2 deletions data/lua/wml-utils.lua
Expand Up @@ -154,8 +154,6 @@ function utils.handle_event_commands(cfg, scope_type)
end
current_exit = "none"
end
-- Apply music alterations once all the commands have been processed.
wesnoth.music_list.force_refresh()
return current_exit
end
Expand Down
2 changes: 2 additions & 0 deletions src/actions/undo_action.cpp
Expand Up @@ -18,6 +18,7 @@
#include "variable.hpp" // vconfig
#include "game_data.hpp"
#include "units/unit.hpp"
#include "sound.hpp"

#include <cassert>
#include <iterator>
Expand Down Expand Up @@ -113,6 +114,7 @@ namespace {

game_events::queued_event q(tag, "", map_location(x1, y1, wml_loc()), map_location(x2, y2, wml_loc()), e.data);
resources::lua_kernel->run_wml_action("command", vconfig(e.commands), q);
sound::commit_music_changes();

x1 = oldx1; y1 = oldy1;
x2 = oldx2; y2 = oldy2;
Expand Down
2 changes: 2 additions & 0 deletions src/game_events/handlers.cpp
Expand Up @@ -30,6 +30,7 @@
#include "reports.hpp"
#include "scripting/game_lua_kernel.hpp"
#include "serialization/string_utils.hpp"
#include "sound.hpp"
#include "soundsource.hpp"

#include <iostream>
Expand Down Expand Up @@ -127,6 +128,7 @@ void event_handler::handle_event(const queued_event& event_info, handler_ptr& ha
// *WARNING*: At this point, dereferencing this could be a memory violation!

lk.run_wml_action("command", vcfg, event_info);
sound::commit_music_changes();
}

bool event_handler::matches_name(const std::string &name, const game_data * gd) const
Expand Down

0 comments on commit 5b79669

Please sign in to comment.