add and implement next_scenario_append

This commit is contained in:
Chris Beck 2014-02-19 10:37:27 -05:00
parent d07c784ae5
commit 655a08beed
4 changed files with 20 additions and 0 deletions

View file

@ -34,6 +34,7 @@ end_level_data::end_level_data()
, carryover_add(false)
, transient()
, next_scenario_settings()
, next_scenario_append()
{
}
@ -47,6 +48,10 @@ void end_level_data::write(config& cfg) const
if (!next_scenario_settings.empty()) {
cfg.add_child("next_scenario_settings", next_scenario_settings);
}
if (!next_scenario_append.empty()) {
cfg.add_child("next_scenario_append", next_scenario_append);
}
}
void end_level_data::read(const config& cfg)
@ -60,4 +65,9 @@ void end_level_data::read(const config& cfg)
if (!next_scenario_settings_cfg.empty()) {
next_scenario_settings = next_scenario_settings_cfg;
}
const config & next_scenario_append_cfg = cfg.child_or_empty("next_scenario_append");
if (!next_scenario_append_cfg.empty()) {
next_scenario_append = next_scenario_append_cfg;
}
}

View file

@ -109,6 +109,7 @@ struct end_level_data
transient_end_level transient;
config next_scenario_settings;
config next_scenario_append;
void write(config& cfg) const;

View file

@ -730,6 +730,10 @@ WML_HANDLER_FUNCTION(endlevel, /*event_info*/, cfg)
if (!next_scenario_settings_cfg.empty()) {
data.next_scenario_settings = next_scenario_settings_cfg;
}
const config next_scenario_append_cfg = cfg.get_parsed_config().child_or_empty("next_scenario_append");
if (!next_scenario_append_cfg.empty()) {
data.next_scenario_append = next_scenario_append_cfg;
}
}
std::string end_of_campaign_text = cfg["end_text"];

View file

@ -80,6 +80,10 @@ static void do_carryover_WML(config & level, game_state& gamestate){
if(!end_level_.next_scenario_settings.empty()) {
level.merge_with(end_level_.next_scenario_settings);
}
if(!end_level_.next_scenario_append.empty())
{
level.append_children(end_level_.next_scenario_append);
}
}
}
@ -88,6 +92,7 @@ static void clear_carryover_WML (game_state & gamestate) {
if (gamestate.carryover_sides.has_child("end_level_data")) {
config & eld = gamestate.carryover_sides.child("end_level_data");
eld.clear_children("next_scenario_settings");
eld.clear_children("next_scenario_append");
}
}