Moved [command] implementation to Lua.
This commit is contained in:
parent
2000467e12
commit
093c9996ee
2 changed files with 11 additions and 7 deletions
|
@ -278,3 +278,14 @@ end
|
||||||
function wml_actions.music(cfg)
|
function wml_actions.music(cfg)
|
||||||
wesnoth.set_music(cfg)
|
wesnoth.set_music(cfg)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function handle_event_commands(cfg)
|
||||||
|
for i = 1, #cfg do
|
||||||
|
local v = cfg[i]
|
||||||
|
wml_actions[v[1]](v[2])
|
||||||
|
end
|
||||||
|
-- Apply music alterations once all the commands have been processed.
|
||||||
|
wesnoth.set_music()
|
||||||
|
end
|
||||||
|
|
||||||
|
wml_actions.command = handle_event_commands
|
||||||
|
|
|
@ -2603,13 +2603,6 @@ WML_HANDLER_FUNCTION(heal_unit, event_info, cfg)
|
||||||
resources::state_of_game->get_variable("heal_amount") = real_amount;
|
resources::state_of_game->get_variable("heal_amount") = real_amount;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sub commands that need to be handled in a guaranteed ordering
|
|
||||||
WML_HANDLER_FUNCTION(command, event_info, cfg)
|
|
||||||
{
|
|
||||||
handle_event_commands(event_info, cfg);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Allow undo sets the flag saying whether the event has mutated the game to false
|
// Allow undo sets the flag saying whether the event has mutated the game to false
|
||||||
WML_HANDLER_FUNCTION(allow_undo,/*event_info*/,/*cfg*/)
|
WML_HANDLER_FUNCTION(allow_undo,/*event_info*/,/*cfg*/)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue