Permalink
Browse files

add and implement next_scenario_append

  • Loading branch information...
1 parent d07c784 commit 655a08beed2d2344fbf0d91fe4fe199a4a7f684c @cbeck88 cbeck88 committed Feb 19, 2014
Showing with 20 additions and 0 deletions.
  1. +10 −0 src/game_end_exceptions.cpp
  2. +1 −0 src/game_end_exceptions.hpp
  3. +4 −0 src/game_events/action_wml.cpp
  4. +5 −0 src/playcampaign.cpp
@@ -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;
+ }
+
}
@@ -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;
@@ -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"];
@@ -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");
}
}

0 comments on commit 655a08b

Please sign in to comment.