From ab13cb19e636649ca860b5aaf53856a90f549550 Mon Sep 17 00:00:00 2001 From: Eugen Jiresch Date: Mon, 21 Sep 2009 13:56:35 +0000 Subject: [PATCH] when populating game_state.variables_, ...snapshot/replay_start is now prioritized over savefile root --- src/gamestatus.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/gamestatus.cpp b/src/gamestatus.cpp index 47a40054b8c..ede53c29516 100644 --- a/src/gamestatus.cpp +++ b/src/gamestatus.cpp @@ -289,8 +289,16 @@ game_state::game_state(const config& cfg, bool show_replay) : if(classification_.campaign_type.empty()) { classification_.campaign_type = "scenario"; } - - if (const config &vars = cfg.child("variables")) { + + //priority of populating wml variables: + //snapshot -> replay_start -> root + if (const config &vars = snapshot.child("variables")) { + set_variables(vars); + } + else if (const config &vars = replay_start.child("variables")) { + set_variables(vars); + } + else if (const config &vars = cfg.child("variables")) { set_variables(vars); } set_menu_items(cfg.child_range("menu_item"));