Enable scenarios to change theme in an event

This commit is contained in:
Celtic Minstrel 2017-04-24 09:52:18 -04:00
parent b9a35fa870
commit 1fb4d36ef8
3 changed files with 12 additions and 0 deletions

View file

@ -14,6 +14,7 @@ Version 1.13.7+dev:
logging data into a saved game.
* Small change to animator API - facing parameter replaced with target and required to be
a space adjacent to the unit.
* New modifiable theme attribute in wesnoth.game_config
* Multiplayer:
* Fixed statistics being lost when reloading an MP game.
* Performance:
@ -38,6 +39,7 @@ Version 1.13.7+dev:
* Canvas colors can now be expressed as formulas. The formula must return
the color as a list of its components, eg "([r, g, b, a])"
* Empty tags are no longer written to the configs of [unit]s and [side]s.
* New [change_theme] tag to change the theme mid-scenario
Version 1.13.7:
* AI:

View file

@ -1413,6 +1413,10 @@ function wml_actions.set_variable(cfg)
end
end
function wesnoth.wml_actions.change_theme(cfg)
wesnoth.game_config.theme = cfg.theme
end
function wesnoth.wml_conditionals.proceed_to_next_scenario(cfg)
local endlevel_data = wesnoth.get_end_level_data()
if not endlevel_data then

View file

@ -1236,6 +1236,7 @@ int game_lua_kernel::impl_game_config_get(lua_State *L)
return_int_attrib("last_turn", tod_man().number_of_turns());
return_string_attrib("version", game_config::version);
return_string_attrib("next_scenario", gamedata().next_scenario());
return_string_attrib("theme", gamedata().get_theme());
return_bool_attrib("debug", game_config::debug);
return_bool_attrib("debug_lua", game_config::debug_lua);
return_bool_attrib("mp_debug", game_config::mp_debug);
@ -1285,6 +1286,11 @@ int game_lua_kernel::impl_game_config_set(lua_State *L)
modify_int_attrib("kill_experience", game_config::kill_experience = value);
modify_int_attrib("last_turn", tod_man().set_number_of_turns_by_wml(value));
modify_string_attrib("next_scenario", gamedata().set_next_scenario(value));
modify_string_attrib("theme",
gamedata().set_theme(value);
const config& game_config = game_config_manager::get()->game_config();
game_display_->set_theme(play_controller_.get_theme(game_config, value));
);
modify_vector_string_attrib("defeat_music", gamedata().set_defeat_music(std::move(value)));
modify_vector_string_attrib("victory_music", gamedata().set_victory_music(std::move(value)));
std::string err_msg = "unknown modifiable property of game_config: ";