/** * Copies [scenario] attributes/tags that are not otherwise stored in C++ structs/clases. */ static void copy_persistent(const config& src, config& dst) { typedef boost::container::flat_set<std::string> stringset; static stringset attrs = boost::assign::list_of ("id") ("theme") ("next_scenario") ("description") ("name") ("defeat_music") ("victory_music") ("victory_when_enemies_defeated") ("remove_from_carryover_on_defeat") ("disallow_recall") ("experience_modifier") ("require_scenario") .convert_to_container<stringset>(); static stringset tags = boost::assign::list_of ("terrain_graphics") .convert_to_container<stringset>(); BOOST_FOREACH(const std::string& attr, attrs) { dst[attr] = src[attr]; } BOOST_FOREACH(const std::string& tag, tags) { dst.append_children(src, tag); }
/** * Copies [scenario] attributes/tags that are not otherwise stored in C++ structs/clases. */ static void copy_persistent(const config& src, config& dst) { static const std::set<std::string> attrs = { "id", "theme", "next_scenario", "description", "name", "defeat_music", "victory_music", "victory_when_enemies_defeated", "remove_from_carryover_on_defeat", "disallow_recall", "experience_modifier", "require_scenario" }; static const std::set<std::string> tags = { "terrain_graphics", "lua" }; for (const std::string& attr : attrs) { dst[attr] = src[attr]; } for (const std::string& tag : tags) { dst.append_children(src, tag); } }