From 491c2361134e7c471d8a77088bfdca475258b431 Mon Sep 17 00:00:00 2001 From: Charles Dang Date: Wed, 16 Oct 2024 03:40:16 -0400 Subject: [PATCH] Config: deploy all_children_view en-mass --- src/actions/undo.cpp | 2 +- src/actions/undo_move_action.cpp | 2 +- src/addon/client.cpp | 4 +-- src/ai/configuration.cpp | 4 +-- src/config.cpp | 20 ++++++------- src/config_cache.cpp | 2 +- src/editor/map/map_context.cpp | 4 +-- src/formula/callable_objects.cpp | 6 ++-- src/game_config_manager.cpp | 2 +- src/game_events/handlers.cpp | 2 +- src/game_events/manager.cpp | 2 +- src/generators/cave_map_generator.cpp | 2 +- src/gui/core/canvas.cpp | 4 +-- src/gui/dialogs/gamestate_inspector.cpp | 6 ++-- .../dialogs/multiplayer/mp_options_helper.cpp | 4 +-- src/gui/widgets/rich_label.cpp | 12 ++++---- src/help/help_impl.cpp | 16 +++++----- src/play_controller.cpp | 2 +- src/preferences/preferences.cpp | 6 ++-- src/replay.cpp | 8 ++--- src/scripting/game_lua_kernel.cpp | 2 +- src/scripting/lua_common.cpp | 2 +- src/scripting/lua_unit.cpp | 4 +-- src/scripting/lua_wml.cpp | 2 +- src/serialization/parser.cpp | 2 +- src/serialization/schema_validator.cpp | 2 +- src/theme.cpp | 6 ++-- src/units/abilities.cpp | 30 +++++++++---------- src/units/animation.cpp | 10 +++---- src/units/attack_type.cpp | 6 ++-- src/units/filter.cpp | 8 ++--- src/units/types.cpp | 12 ++++---- src/units/unit.cpp | 20 ++++++------- src/variable.cpp | 6 ++-- src/wesnoth.cpp | 2 +- 35 files changed, 112 insertions(+), 112 deletions(-) diff --git a/src/actions/undo.cpp b/src/actions/undo.cpp index c9ed96c8eb3..7ad7867bc45 100644 --- a/src/actions/undo.cpp +++ b/src/actions/undo.cpp @@ -388,7 +388,7 @@ void undo_list::redo() auto action = std::move(redos_.back()); redos_.pop_back(); - auto [commandname, data] = action->mandatory_child("command").all_children_range().front(); + auto [commandname, data] = action->mandatory_child("command").all_children_view().front(); // Note that this might add more than one [command] resources::recorder->redo(*action); diff --git a/src/actions/undo_move_action.cpp b/src/actions/undo_move_action.cpp index 8b930cc4888..249bd591088 100644 --- a/src/actions/undo_move_action.cpp +++ b/src/actions/undo_move_action.cpp @@ -108,7 +108,7 @@ bool move_action::undo(int) // Move the unit. unit_display::move_unit(rev_route, u.get_shared_ptr(), true, starting_dir); bool halo_adjacent = false; - for(const auto [_, cfg] : u->abilities().all_children_range()){ + for(const auto [_, cfg] : u->abilities().all_children_view()){ if(!cfg["halo_image"].empty() && cfg.has_child("affect_adjacent")){ halo_adjacent = true; break; diff --git a/src/addon/client.cpp b/src/addon/client.cpp index 7a0fae8cb85..f4a78b20d45 100644 --- a/src/addon/client.cpp +++ b/src/addon/client.cpp @@ -353,7 +353,7 @@ bool addons_client::install_addon(config& archive_cfg, const addon_info& info) LOG_ADDONS << "Received an updatepack for the addon '" << info.id << "'"; // A consistency check - for(const auto [key, cfg] : archive_cfg.all_children_range()) { + for(const auto [key, cfg] : archive_cfg.all_children_view()) { if(key == "removelist" || key == "addlist") { if(!check_names_legal(cfg)) { gui2::show_error_message(VGETTEXT("The add-on $addon_title has an invalid file or directory " @@ -367,7 +367,7 @@ bool addons_client::install_addon(config& archive_cfg, const addon_info& info) } } - for(const auto [key, cfg] : archive_cfg.all_children_range()) { + for(const auto [key, cfg] : archive_cfg.all_children_view()) { if(key == "removelist") { purge_addon(cfg); } else if(key == "addlist") { diff --git a/src/ai/configuration.cpp b/src/ai/configuration.cpp index 6fd76d30f3e..ac16495c1d9 100644 --- a/src/ai/configuration.cpp +++ b/src/ai/configuration.cpp @@ -311,7 +311,7 @@ void configuration::expand_simplified_aspects(side_number side, config &cfg) { facet_config["value"] = value; facet_configs.emplace_back(key, facet_config); } - for(const auto [child_key, child_cfg] : aiparam.all_children_range()) { + for(const auto [child_key, child_cfg] : aiparam.all_children_view()) { if (just_copy_tags.count(child_key)) { // These aren't simplified, so just copy over unchanged. parsed_config.add_child(child_key, child_cfg); @@ -386,7 +386,7 @@ void configuration::expand_simplified_aspects(side_number side, config &cfg) { if (algorithm.empty() && !parsed_config.has_child("stage")) { base_config = get_ai_config_for(default_ai_algorithm_); } - for(const auto [child_key, child_cfg] : parsed_config.all_children_range()) { + for(const auto [child_key, child_cfg] : parsed_config.all_children_view()) { base_config.add_child(child_key, child_cfg); } cfg.clear_children("ai"); diff --git a/src/config.cpp b/src/config.cpp index 15bd6f702eb..bbb9848073c 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -165,7 +165,7 @@ void config::remove_attribute(config_key_type key) void config::append_children(const config& cfg) { - for(const auto [key, cfg] : cfg.all_children_range()) { + for(const auto [key, cfg] : cfg.all_children_view()) { add_child(key, cfg); } } @@ -179,7 +179,7 @@ void config::append_children(config&& cfg) cfg.clear_all_children(); return; } - for(const auto [child_key, child_value] : cfg.all_children_range()) { + for(const auto [child_key, child_value] : cfg.all_children_view()) { add_child(child_key, std::move(child_value)); } cfg.clear_all_children(); @@ -1047,7 +1047,7 @@ void config::apply_diff(const config& diff, bool track /* = false */) for(const config& i : diff.child_range("change_child")) { const std::size_t index = lexical_cast(i["index"].str()); - for(const auto [key, cfg] : i.all_children_range()) { + for(const auto [key, cfg] : i.all_children_view()) { if(key.empty()) { continue; } @@ -1063,7 +1063,7 @@ void config::apply_diff(const config& diff, bool track /* = false */) for(const config& i : diff.child_range("insert_child")) { const auto index = lexical_cast(i["index"].str()); - for(const auto [key, cfg] : i.all_children_range()) { + for(const auto [key, cfg] : i.all_children_view()) { config& inserted = add_child_at(key, cfg, index); if(track) { inserted[diff_track_attribute] = "new"; @@ -1073,7 +1073,7 @@ void config::apply_diff(const config& diff, bool track /* = false */) for(const config& i : diff.child_range("delete_child")) { const auto index = lexical_cast(i["index"].str()); - for(const auto [key, cfg] : i.all_children_range()) { + for(const auto [key, cfg] : i.all_children_view()) { if(!track) { remove_child(key, index); } else { @@ -1093,14 +1093,14 @@ void config::clear_diff_track(const config& diff) remove_attribute(diff_track_attribute); for(const config& i : diff.child_range("delete_child")) { const auto index = lexical_cast(i["index"].str()); - for(const auto [key, cfg] : i.all_children_range()) { + for(const auto [key, cfg] : i.all_children_view()) { remove_child(key, index); } } for(const config& i : diff.child_range("change_child")) { const std::size_t index = lexical_cast(i["index"].str()); - for(const auto [key, cfg] : i.all_children_range()) { + for(const auto [key, cfg] : i.all_children_view()) { if(key.empty()) { continue; } @@ -1215,7 +1215,7 @@ bool config::matches(const config& filter) const } } - for(const auto [key, cfg] : filter.all_children_range()) { + for(const auto [key, cfg] : filter.all_children_view()) { if(key == "not") { result = result && !matches(cfg); continue; @@ -1265,7 +1265,7 @@ std::ostream& operator<<(std::ostream& outstream, const config& cfg) outstream << key << " = " << value << '\n'; } - for(const auto [key, cfg] : cfg.all_children_range()) { + for(const auto [key, cfg] : cfg.all_children_view()) { for(int j = 0; j < i - 1; ++j) { outstream << '\t'; } @@ -1319,7 +1319,7 @@ std::string config::hash() const } } - for(const auto [key, cfg] : all_children_range()) { + for(const auto [key, cfg] : all_children_view()) { std::string child_hash = cfg.hash(); for(char c : child_hash) { hash_str[i] ^= c; diff --git a/src/config_cache.cpp b/src/config_cache.cpp index df021b9a38e..5d1cac52d0b 100644 --- a/src/config_cache.cpp +++ b/src/config_cache.cpp @@ -270,7 +270,7 @@ void config_cache::read_defines_file(const std::string& file_path) // use static preproc_define::read_pair(config) to make a object // and pass that object config_cache_transaction::insert_to_active method - for(const auto [key, cfg] : cfg.all_children_range()) { + for(const auto [key, cfg] : cfg.all_children_view()) { config_cache_transaction::instance().insert_to_active(preproc_define::read_pair(cfg)); } } diff --git a/src/editor/map/map_context.cpp b/src/editor/map/map_context.cpp index 49c43a1f3e3..cdabc0cd3b3 100644 --- a/src/editor/map/map_context.cpp +++ b/src/editor/map/map_context.cpp @@ -419,7 +419,7 @@ config map_context::convert_scenario(const config& old_scenario) // if [unit], set the unit's side // for [time]: // keep under [multiplayer] - for(const auto [child_key, child_cfg]: old_scenario.all_children_range()) { + for(const auto [child_key, child_cfg]: old_scenario.all_children_view()) { if(child_key != "side" && child_key != "time") { config& c = event.add_child(child_key); c.append_attributes(child_cfg); @@ -427,7 +427,7 @@ config map_context::convert_scenario(const config& old_scenario) } else if(child_key == "side") { config& c = multiplayer.add_child("side"); c.append_attributes(child_cfg); - for(const auto [side_key, side_cfg] : child_cfg.all_children_range()) { + for(const auto [side_key, side_cfg] : child_cfg.all_children_view()) { if(side_key == "village") { config& c1 = c.add_child("village"); c1.append_attributes(side_cfg); diff --git a/src/formula/callable_objects.cpp b/src/formula/callable_objects.cpp index f0adf0ba1e8..12438673731 100644 --- a/src/formula/callable_objects.cpp +++ b/src/formula/callable_objects.cpp @@ -118,7 +118,7 @@ variant attack_type_callable::get_value(const std::string& key) const } else if(key == "specials" || key == "special") { std::vector res; - for(const auto [_, special_cfg] : att_->specials().all_children_range()) { + for(const auto [_, special_cfg] : att_->specials().all_children_view()) { if(!special_cfg["id"].empty()) { res.emplace_back(special_cfg["id"].str()); } @@ -549,7 +549,7 @@ variant config_callable::get_value(const std::string& key) const return variant(result); } else if(key == "__all_children") { std::vector result; - for(const auto [child_key, child_cfg] : cfg_.all_children_range()) { + for(const auto [child_key, child_cfg] : cfg_.all_children_view()) { const variant cfg_child(std::make_shared(child_cfg)); const variant kv(std::make_shared(variant(child_key), cfg_child)); result.push_back(kv); @@ -558,7 +558,7 @@ variant config_callable::get_value(const std::string& key) const return variant(result); } else if(key == "__children") { std::map> build; - for(const auto [child_key, child_cfg] : cfg_.all_children_range()) { + for(const auto [child_key, child_cfg] : cfg_.all_children_view()) { const variant cfg_child(std::make_shared(child_cfg)); build[child_key].push_back(cfg_child); } diff --git a/src/game_config_manager.cpp b/src/game_config_manager.cpp index a1dbb3cb8ff..df694d0b773 100644 --- a/src/game_config_manager.cpp +++ b/src/game_config_manager.cpp @@ -569,7 +569,7 @@ void game_config_manager::load_addons_cfg() }; // Annotate appropriate addon types with addon_id info. - for(auto [key, cfg] : umc_cfg.all_children_range()) { + for(auto [key, cfg] : umc_cfg.all_children_view()) { if(tags_with_addon_id.count(key) > 0) { cfg["addon_id"] = addon_id; cfg["addon_title"] = addon_title; diff --git a/src/game_events/handlers.cpp b/src/game_events/handlers.cpp index bf35081c98f..531b49623ee 100644 --- a/src/game_events/handlers.cpp +++ b/src/game_events/handlers.cpp @@ -362,7 +362,7 @@ private: void event_handler::read_filters(const config &cfg) { - for(const auto [filter_key, filter_cfg] : cfg.all_children_range()) { + for(const auto [filter_key, filter_cfg] : cfg.all_children_view()) { vconfig vcfg(filter_cfg); if(auto filter_ptr = make_filter(filter_key, vcfg)) { add_filter(std::move(filter_ptr)); diff --git a/src/game_events/manager.cpp b/src/game_events/manager.cpp index fed79e04c47..31d68fa8046 100644 --- a/src/game_events/manager.cpp +++ b/src/game_events/manager.cpp @@ -83,7 +83,7 @@ void manager::add_event_handler_from_wml(const config& handler, game_lua_kernel& } args[attr] = val; } - for(auto [key, cfg] : handler.all_children_range()) { + for(auto [key, cfg] : handler.all_children_view()) { if(key.compare(0, 6, "filter") != 0) { args.add_child(key, cfg); } diff --git a/src/generators/cave_map_generator.cpp b/src/generators/cave_map_generator.cpp index 819f2831f0b..9cbe24703b5 100644 --- a/src/generators/cave_map_generator.cpp +++ b/src/generators/cave_map_generator.cpp @@ -224,7 +224,7 @@ void cave_map_generator::cave_map_generator_job::place_chamber(const chamber& c) if (c.items == nullptr || c.locs.empty()) return; std::size_t index = 0; - for(const auto [child_key, child_cfg] : c.items->all_children_range()) + for(const auto [child_key, child_cfg] : c.items->all_children_view()) { config cfg = child_cfg; auto filter = cfg.optional_child("filter"); diff --git a/src/gui/core/canvas.cpp b/src/gui/core/canvas.cpp index 6d3b4f96d4c..699acf54deb 100644 --- a/src/gui/core/canvas.cpp +++ b/src/gui/core/canvas.cpp @@ -663,7 +663,7 @@ void canvas::parse_cfg(const config& cfg) { log_scope2(log_gui_parse, "Canvas: parsing config."); - for(const auto [type, data] : cfg.all_children_range()) + for(const auto [type, data] : cfg.all_children_view()) { DBG_GUI_P << "Canvas: found shape of the type " << type << "."; @@ -682,7 +682,7 @@ void canvas::parse_cfg(const config& cfg) } else if(type == "pre_commit") { /* note this should get split if more preprocessing is used. */ - for(const auto [func_key, func_cfg] : data.all_children_range()) + for(const auto [func_key, func_cfg] : data.all_children_view()) { if(func_key == "blur") { blur_depth_ = func_cfg["depth"].to_unsigned(); diff --git a/src/gui/dialogs/gamestate_inspector.cpp b/src/gui/dialogs/gamestate_inspector.cpp index 394d2516d81..f75a6bc153d 100644 --- a/src/gui/dialogs/gamestate_inspector.cpp +++ b/src/gui/dialogs/gamestate_inspector.cpp @@ -512,7 +512,7 @@ void variable_mode_controller::show_list(tree_view_node& node) std::map wml_array_sizes; - for(const auto [key, cfg] : vars().all_children_range()) + for(const auto [key, cfg] : vars().all_children_view()) { std::ostringstream cur_str; cur_str << "[" << key << "][" << wml_array_sizes[key] << "]"; @@ -659,7 +659,7 @@ void unit_mode_controller::show_unit(tree_view_node& node) std::map wml_array_sizes; - for(const auto [key, cfg] : u->variables().all_children_range()) + for(const auto [key, cfg] : u->variables().all_children_view()) { std::ostringstream cur_str; cur_str << "[" << key << "][" << wml_array_sizes[key] << "]"; @@ -863,7 +863,7 @@ void team_mode_controller::show_vars(tree_view_node& node, int side) std::map wml_array_sizes; - for(const auto [key, cfg] : t.variables().all_children_range()) + for(const auto [key, cfg] : t.variables().all_children_view()) { std::ostringstream cur_str; cur_str << "[" << key << "][" << wml_array_sizes[key] << "]"; diff --git a/src/gui/dialogs/multiplayer/mp_options_helper.cpp b/src/gui/dialogs/multiplayer/mp_options_helper.cpp index ebbf684b59a..f07097bd6b6 100644 --- a/src/gui/dialogs/multiplayer/mp_options_helper.cpp +++ b/src/gui/dialogs/multiplayer/mp_options_helper.cpp @@ -39,7 +39,7 @@ mp_options_helper::mp_options_helper(window& window, ng::create_engine& create_e , visible_options_() , options_data_() { - for(const auto [_, cfg] : prefs::get().options().all_children_range()) { + for(const auto [_, cfg] : prefs::get().options().all_children_view()) { for(const auto& saved_option : cfg.child_range("option")) { options_data_[cfg["id"]][saved_option["id"].str()] = saved_option["value"]; } @@ -224,7 +224,7 @@ void mp_options_helper::display_custom_options(const std::string& type, int node tree_view_node& option_node = options_tree_.add_node("option_node", data, node_position); type_node_vector.push_back(&option_node); - for(const auto [option_key, option_cfg] : options.all_children_range()) { + for(const auto [option_key, option_cfg] : options.all_children_view()) { data.clear(); item.clear(); diff --git a/src/gui/widgets/rich_label.cpp b/src/gui/widgets/rich_label.cpp index 80f2631067d..cf3bb7e6051 100644 --- a/src/gui/widgets/rich_label.cpp +++ b/src/gui/widgets/rich_label.cpp @@ -303,7 +303,7 @@ std::pair rich_label::get_parsed_text( DBG_GUI_RL << parsed_text.debug(); - for(const auto [key, child] : parsed_text.all_children_range()) { + for(const auto [key, child] : parsed_text.all_children_view()) { if(key == "img") { std::string name = child["src"]; std::string align = child["align"]; @@ -428,7 +428,7 @@ std::pair rich_label::get_parsed_text( max_row_height = std::max(max_row_height, static_cast(size.y)); col_x += col_widths[col_idx] + 2 * padding_; - config& end_cfg = text_dom.all_children_range().back().cfg; + auto [_, end_cfg] = text_dom.all_children_view().back(); end_cfg["actions"] = boost::str(boost::format("([set_var('pos_x', %d), set_var('pos_y', %d), set_var('tw', width - %d - %d)])") % col_x % row_y % col_x % (width/columns)); DBG_GUI_RL << "jump to next column"; @@ -441,7 +441,7 @@ std::pair rich_label::get_parsed_text( } row_y += max_row_height + padding_; - config& end_cfg = text_dom.all_children_range().back().cfg; + auto [_, end_cfg] = text_dom.all_children_view().back(); end_cfg["actions"] = boost::str(boost::format("([set_var('pos_x', 0), set_var('pos_y', %d), set_var('tw', width - %d - %d)])") % row_y % col_x % col_widths[columns-1]); DBG_GUI_RL << "row height: " << max_row_height; } @@ -449,7 +449,7 @@ std::pair rich_label::get_parsed_text( prev_blk_height = row_y; text_height = 0; - config& end_cfg = text_dom.all_children_range().back().cfg; + auto [_, end_cfg] = text_dom.all_children_view().back(); end_cfg["actions"] = boost::str(boost::format("([set_var('pos_x', 0), set_var('pos_y', %d), set_var('tw', 0)])") % row_y); is_image = false; @@ -558,7 +558,7 @@ std::pair rich_label::get_parsed_text( add_text_with_attribute(*curr_item, line, key); config parsed_children = get_parsed_text(child, point(x, prev_blk_height), init_width).first; - for (const auto [parsed_key, parsed_cfg] : parsed_children.all_children_range()) { + for (const auto [parsed_key, parsed_cfg] : parsed_children.all_children_view()) { if (parsed_key == "text") { const auto [start, end] = add_text(*curr_item, parsed_cfg["text"]); for (const config& attr : parsed_cfg.child_range("attribute")) { @@ -685,7 +685,7 @@ std::pair rich_label::get_parsed_text( (*curr_item)["actions"] = "([set_var('pos_x', 0), set_var('pos_y', pos_y + " + std::to_string(img_size.y) + ")])"; text_dom.append(*remaining_item); remaining_item = nullptr; - curr_item = &text_dom.all_children_range().back().cfg; + curr_item = &text_dom.all_children_view().back().second; } } diff --git a/src/help/help_impl.cpp b/src/help/help_impl.cpp index 1cff5f0ecdf..10facd05cfc 100644 --- a/src/help/help_impl.cpp +++ b/src/help/help_impl.cpp @@ -477,9 +477,9 @@ std::vector generate_weapon_special_topics(const bool sort_generated) for(config adv : type.modification_advancements()) { for(config effect : adv.child_range("effect")) { if(effect["apply_to"] == "new_attack" && effect.has_child("specials")) { - for(config::any_child spec : effect.mandatory_child("specials").all_children_range()) { - if(!spec.cfg["name"].empty()) { - special_description.emplace(spec.cfg["name"].t_str(), spec.cfg["description"].t_str()); + for(const auto [key, special] : effect.mandatory_child("specials").all_children_view()) { + if(!special["name"].empty()) { + special_description.emplace(special["name"].t_str(), special["description"].t_str()); if(!type.hide_help()) { //add a link in the list of units having this special std::string type_name = type.type_name(); @@ -489,14 +489,14 @@ std::vector generate_weapon_special_topics(const bool sort_generated) //we put the translated name at the beginning of the hyperlink, //so the automatic alphabetic sorting of std::set can use it std::string link = markup::make_link(type_name, ref_id); - special_units[spec.cfg["name"]].insert(link); + special_units[special["name"]].insert(link); } } } } else if(effect["apply_to"] == "attack" && effect.has_child("set_specials")) { - for(config::any_child spec : effect.mandatory_child("set_specials").all_children_range()) { - if(!spec.cfg["name"].empty()) { - special_description.emplace(spec.cfg["name"].t_str(), spec.cfg["description"].t_str()); + for(const auto [key, special] : effect.mandatory_child("set_specials").all_children_view()) { + if(!special["name"].empty()) { + special_description.emplace(special["name"].t_str(), special["description"].t_str()); if(!type.hide_help()) { //add a link in the list of units having this special std::string type_name = type.type_name(); @@ -506,7 +506,7 @@ std::vector generate_weapon_special_topics(const bool sort_generated) //we put the translated name at the beginning of the hyperlink, //so the automatic alphabetic sorting of std::set can use it std::string link = markup::make_link(type_name, ref_id); - special_units[spec.cfg["name"]].insert(link); + special_units[special["name"]].insert(link); } } } diff --git a/src/play_controller.cpp b/src/play_controller.cpp index 1e7080120c6..8d335b3eaf4 100644 --- a/src/play_controller.cpp +++ b/src/play_controller.cpp @@ -1158,7 +1158,7 @@ static void find_next_scenarios(const config& parent, std::set& res result.insert(endlevel["next_scenario"]); } } - for(const auto [key, cfg] : parent.all_children_range()) { + for(const auto [key, cfg] : parent.all_children_view()) { find_next_scenarios(cfg, result); } }; diff --git a/src/preferences/preferences.cpp b/src/preferences/preferences.cpp index 2f3a205d75d..f3d9a49687e 100644 --- a/src/preferences/preferences.cpp +++ b/src/preferences/preferences.cpp @@ -271,12 +271,12 @@ void prefs::load_preferences() } } - for(const auto [key, _] : synced_prefs.all_children_range()) { + for(const auto [key, _] : synced_prefs.all_children_view()) { if(std::find(synced_children_.begin(), synced_children_.end(), key) == synced_children_.end()) { unknown_synced_children_.insert(key); } } - for(const auto [key, _] : unsynced_prefs.all_children_range()) { + for(const auto [key, _] : unsynced_prefs.all_children_view()) { if(std::find(unsynced_children_.begin(), unsynced_children_.end(), key) == unsynced_children_.end()) { unknown_unsynced_children_.insert(key); } @@ -324,7 +324,7 @@ void prefs::load_preferences() message = foobar [/line] */ - for(const auto [key, cfg] : history->all_children_range()) { + for(const auto [key, cfg] : history->all_children_view()) { for(const config& l : cfg.child_range("line")) { history_map_[key].push_back(l["message"]); } diff --git a/src/replay.cpp b/src/replay.cpp index 347bfb26467..c888c8f0a18 100644 --- a/src/replay.cpp +++ b/src/replay.cpp @@ -698,7 +698,7 @@ REPLAY_ACTION_TYPE get_replay_action_type(const config& command) if(command.all_children_count() != 1) { return REPLAY_ACTION_TYPE::INVALID; } - auto [key, _] = command.all_children_range().front(); + auto [key, _] = command.all_children_view().front(); if(key == "speak" || key == "label" || key == "surrender" || key == "clear_labels" || key == "rename" || key == "countdown_update") { return REPLAY_ACTION_TYPE::UNSYNCED; } @@ -750,7 +750,7 @@ REPLAY_RETURN do_replay_handle(bool one_move) } - const auto ch_itors = cfg->all_children_range(); + const auto ch_itors = cfg->all_children_view(); //if there is an empty command tag or a start tag if (ch_itors.empty() || cfg->has_child("start")) { @@ -882,7 +882,7 @@ REPLAY_RETURN do_replay_handle(bool one_move) // but we are called from // the only other option for "dependent" command is checksum which is already checked. assert(cfg->all_children_count() == 1); - auto [child_name, _] = cfg->all_children_range().front(); + auto [child_name, _] = cfg->all_children_view().front(); DBG_REPLAY << "got an dependent action name = " << child_name; resources::recorder->revert_action(); return REPLAY_FOUND_DEPENDENT; @@ -890,7 +890,7 @@ REPLAY_RETURN do_replay_handle(bool one_move) else { //we checked for empty commands at the beginning. - const auto [commandname, data] = cfg->all_children_range().front(); + const auto [commandname, data] = cfg->all_children_view().front(); if(!is_unsynced) { diff --git a/src/scripting/game_lua_kernel.cpp b/src/scripting/game_lua_kernel.cpp index 3d3cab789d4..ff9e8916120 100644 --- a/src/scripting/game_lua_kernel.cpp +++ b/src/scripting/game_lua_kernel.cpp @@ -5762,7 +5762,7 @@ void game_lua_kernel::load_game(const config& level) lua_newtable(L); int k = 1; - for(const auto [child_key, child_cfg] : level.all_children_range()) + for(const auto [child_key, child_cfg] : level.all_children_view()) { if (is_handled_file_tag(child_key)) continue; lua_createtable(L, 2, 0); diff --git a/src/scripting/lua_common.cpp b/src/scripting/lua_common.cpp index 26cc34861c9..de342d9b15c 100644 --- a/src/scripting/lua_common.cpp +++ b/src/scripting/lua_common.cpp @@ -657,7 +657,7 @@ void luaW_filltable(lua_State *L, const config& cfg) return; int k = 1; - for(const auto [child_key, child_cfg] : cfg.all_children_range()) + for(const auto [child_key, child_cfg] : cfg.all_children_view()) { luaW_push_namedtuple(L, {"tag", "contents"}); lua_pushstring(L, child_key.c_str()); diff --git a/src/scripting/lua_unit.cpp b/src/scripting/lua_unit.cpp index 1f48f098c35..f06ece73702 100644 --- a/src/scripting/lua_unit.cpp +++ b/src/scripting/lua_unit.cpp @@ -931,8 +931,8 @@ static int impl_unit_variables_dir(lua_State *L) for(const auto& attr : vars.attribute_range()) { variables.push_back(attr.first); } - for(auto attr : vars.all_children_range()) { - variables.push_back(attr.key); + for(auto [key, cfg] : vars.all_children_view()) { + variables.push_back(key); } lua_push(L, variables); return 1; diff --git a/src/scripting/lua_wml.cpp b/src/scripting/lua_wml.cpp index ccf3e184065..86a5e7b5d8c 100644 --- a/src/scripting/lua_wml.cpp +++ b/src/scripting/lua_wml.cpp @@ -174,7 +174,7 @@ static int intf_wml_merge(lua_State* L) base.append_children(merge); } else { if(mode == "replace") { - for(const auto [key, _] : merge.all_children_range()) { + for(const auto [key, _] : merge.all_children_view()) { base.clear_children(key); } } else if(mode != "merge") { diff --git a/src/serialization/parser.cpp b/src/serialization/parser.cpp index e8440ab9452..9bef9ed3663 100644 --- a/src/serialization/parser.cpp +++ b/src/serialization/parser.cpp @@ -720,7 +720,7 @@ static void write_internal(const config& cfg, std::ostream& out, std::string& te write_key_val(out, key, value, tab, textdomain); } - for(const auto [key, item_cfg] : cfg.all_children_range()) { + for(const auto [key, item_cfg] : cfg.all_children_view()) { if(!config::valid_tag(key)) { ERR_CF << "Config contains invalid tag name '" << key << "', skipping..."; continue; diff --git a/src/serialization/schema_validator.cpp b/src/serialization/schema_validator.cpp index dc6f6e931f8..5d95be8a009 100644 --- a/src/serialization/schema_validator.cpp +++ b/src/serialization/schema_validator.cpp @@ -808,7 +808,7 @@ void schema_self_validator::validate(const config& cfg, const std::string& name, } else if(name == "tag") { bool first_tag = true, first_key = true; std::vector tag_names, key_names; - for(const auto [current_key, current_cfg] : cfg.all_children_range()) { + for(const auto [current_key, current_cfg] : cfg.all_children_view()) { if(current_key == "tag" || current_key == "link") { std::string tag_name = current_cfg["name"]; if(current_key == "link") { diff --git a/src/theme.cpp b/src/theme.cpp index 5ab3d2158ff..18e2a882043 100644 --- a/src/theme.cpp +++ b/src/theme.cpp @@ -226,7 +226,7 @@ static config expand_partialresolution(const config& theme) // cannot add [status] sub-elements, but who cares for(const auto& add : part.child_range("add")) { - for(const auto [key, cfg] : add.all_children_range()) { + for(const auto [key, cfg] : add.all_children_view()) { resolution.add_child(key, cfg); } } @@ -240,7 +240,7 @@ static config expand_partialresolution(const config& theme) static void do_resolve_rects(const config& cfg, config& resolved_config, config* resol_cfg = nullptr) { // recursively resolve children - for(const auto [child_key, child_cfg] : cfg.all_children_range()) { + for(const auto [child_key, child_cfg] : cfg.all_children_view()) { config& dest = resolved_config.add_child(child_key); do_resolve_rects(child_cfg, dest, child_key == "resolution" ? &dest : resol_cfg); } @@ -689,7 +689,7 @@ void theme::add_object(std::size_t sw, std::size_t sh, const config& cfg) } if(const auto status_cfg = cfg.optional_child("status")) { - for(const auto [child_key, child_cfg] : status_cfg->all_children_range()) { + for(const auto [child_key, child_cfg] : status_cfg->all_children_view()) { status_[child_key].reset(new status_item(sw, sh, child_cfg)); } if(const auto unit_image_cfg = status_cfg->optional_child("unit_image")) { diff --git a/src/units/abilities.cpp b/src/units/abilities.cpp index de620aeb6bf..dd2806fa16a 100644 --- a/src/units/abilities.cpp +++ b/src/units/abilities.cpp @@ -263,7 +263,7 @@ std::vector unit::get_ability_list() const { std::vector res; - for(const auto [key, cfg] : this->abilities_.all_children_range()) { + for(const auto [key, cfg] : this->abilities_.all_children_view()) { std::string id = cfg["id"]; if (!id.empty()) res.push_back(std::move(id)); @@ -320,7 +320,7 @@ std::vector> unit::ability { std::vector> res; - for(const auto [_, cfg] : this->abilities_.all_children_range()) + for(const auto [_, cfg] : this->abilities_.all_children_view()) { add_ability_tooltip(cfg, gender_, res, true); } @@ -333,7 +333,7 @@ std::vector> unit::ability std::vector> res; active_list.clear(); - for(const auto [key, cfg] : this->abilities_.all_children_range()) + for(const auto [key, cfg] : this->abilities_.all_children_view()) { bool active = ability_active(key, cfg, loc); if (add_ability_tooltip(cfg, gender_, res, active)) @@ -565,7 +565,7 @@ static void add_string_to_vector(std::vector& image_list, const con std::vector unit::halo_or_icon_abilities(const std::string& image_type) const { std::vector image_list; - for(const auto [key, cfg] : abilities_.all_children_range()){ + for(const auto [key, cfg] : abilities_.all_children_view()){ bool is_active = ability_active(key, cfg, loc_); //Add halo/overlay to owner of ability if active and affect_self is true. if( !cfg[image_type + "_image"].str().empty() && is_active && ability_affects_self(key, cfg, loc_)){ @@ -588,7 +588,7 @@ std::vector unit::halo_or_icon_abilities(const std::string& image_t continue; if ( &*it == this ) continue; - for(const auto [key, cfg] : it->abilities_.all_children_range()) { + for(const auto [key, cfg] : it->abilities_.all_children_view()) { if(!cfg[image_type + "_image"].str().empty() && affects_side(cfg, side(), it->side()) && it->ability_active(key, cfg, adjacent[i]) && ability_affects_adjacent(key, cfg, i, loc_, *it)) { add_string_to_vector(image_list, cfg, image_type + "_image"); @@ -767,7 +767,7 @@ namespace { std::vector& id_result, const config& parent, const std::string& id, bool just_peeking=false) { - for(const auto [key, cfg] : parent.all_children_range()) + for(const auto [key, cfg] : parent.all_children_view()) { if (just_peeking && (key == id || cfg["id"] == id)) { return true; // peek succeeded; done @@ -788,7 +788,7 @@ namespace { bool get_special_children_id(std::vector& id_result, const config& parent, const std::string& id, bool just_peeking=false) { - for(const auto [key, cfg] : parent.all_children_range()) + for(const auto [key, cfg] : parent.all_children_view()) { if (just_peeking && (cfg["id"] == id)) { return true; // peek succeeded; done @@ -805,7 +805,7 @@ namespace { bool get_special_children_tags(std::vector& tag_result, const config& parent, const std::string& id, bool just_peeking=false) { - for(const auto [key, cfg] : parent.all_children_range()) + for(const auto [key, cfg] : parent.all_children_view()) { if (just_peeking && (key == id)) { return true; // peek succeeded; done @@ -940,7 +940,7 @@ std::vector> attack_type::special_tooltips( if ( active_list ) active_list->clear(); - for(const auto [key, cfg] : specials_.all_children_range()) + for(const auto [key, cfg] : specials_.all_children_view()) { if ( !active_list || special_active(cfg, AFFECT_EITHER, key) ) { const t_string &name = cfg["name"]; @@ -990,7 +990,7 @@ std::string attack_type::weapon_specials() const { //log_scope("weapon_specials"); std::string res; - for(const auto [key, cfg] : specials_.all_children_range()) + for(const auto [key, cfg] : specials_.all_children_view()) { const bool active = special_active(cfg, AFFECT_EITHER, key); @@ -1039,7 +1039,7 @@ std::string attack_type::weapon_specials_value(const std::set check //log_scope("weapon_specials_value"); std::string temp_string, weapon_abilities; std::set checking_name; - for(const auto [key, cfg] : specials_.all_children_range()) { + for(const auto [key, cfg] : specials_.all_children_view()) { if((checking_tags.count(key) != 0)){ const bool active = special_active(cfg, AFFECT_SELF, key); add_name(temp_string, active, cfg["name"].str(), checking_name); @@ -1060,7 +1060,7 @@ std::string attack_type::weapon_specials_value(const std::set check if(other_attack_) { - for(const auto [key, cfg] : other_attack_->specials_.all_children_range()) { + for(const auto [key, cfg] : other_attack_->specials_.all_children_view()) { if((checking_tags.count(key) != 0)){ const bool active = other_attack_->special_active(cfg, AFFECT_OTHER, key); add_name(temp_string, active, cfg["name"].str(), checking_name); @@ -1086,7 +1086,7 @@ void attack_type::weapon_specials_impl_self( bool leader_bool) { if(self){ - for(const auto [key, cfg] : self->abilities().all_children_range()){ + for(const auto [key, cfg] : self->abilities().all_children_view()){ bool tag_checked = (!checking_tags.empty()) ? (checking_tags.count(key) != 0) : true; const bool active = tag_checked && check_self_abilities_impl(self_attack, other_attack, cfg, self, self_loc, whom, key, leader_bool); add_name(temp_string, active, cfg["name"].str(), checking_name); @@ -1115,7 +1115,7 @@ void attack_type::weapon_specials_impl_adj( continue; if(&*it == self.get()) continue; - for(const auto [key, cfg] : it->abilities().all_children_range()) { + for(const auto [key, cfg] : it->abilities().all_children_view()) { bool tag_checked = (!checking_tags.empty()) ? (checking_tags.count(key) != 0) : true; bool default_bool = (affect_adjacents == "affect_allies") ? true : false; bool affect_allies = (!affect_adjacents.empty()) ? cfg[affect_adjacents].to_bool(default_bool) : true; @@ -2066,7 +2066,7 @@ namespace bool matches = matches_ability_filter(cfg, tag_name, filter); // Handle [and], [or], and [not] with in-order precedence - for(const auto [key, condition_cfg] : filter.all_children_range() ) + for(const auto [key, condition_cfg] : filter.all_children_view() ) { // Handle [and] if ( key == "and" ) diff --git a/src/units/animation.cpp b/src/units/animation.cpp index c13f4080f8b..ded0e1998aa 100644 --- a/src/units/animation.cpp +++ b/src/units/animation.cpp @@ -294,20 +294,20 @@ unit_animation::unit_animation(const config& cfg,const std::string& frame_string { //if(!cfg["debug"].empty()) printf("DEBUG WML: FINAL\n%s\n\n",cfg.debug().c_str()); - for(const config::any_child fr : cfg.all_children_range()) { - if(fr.key == frame_string) { + for(const auto [key, frame] : cfg.all_children_view()) { + if(key == frame_string) { continue; } - if(fr.key.find("_frame", fr.key.size() - 6) == std::string::npos) { + if(key.find("_frame", key.size() - 6) == std::string::npos) { continue; } - if(sub_anims_.find(fr.key) != sub_anims_.end()) { + if(sub_anims_.find(key) != sub_anims_.end()) { continue; } - sub_anims_[fr.key] = particle(cfg, fr.key.substr(0, fr.key.size() - 5)); + sub_anims_[key] = particle(cfg, key.substr(0, key.size() - 5)); } event_ = utils::split(cfg["apply_to"]); diff --git a/src/units/attack_type.cpp b/src/units/attack_type.cpp index 59356635198..5ddb96a925c 100644 --- a/src/units/attack_type.cpp +++ b/src/units/attack_type.cpp @@ -290,7 +290,7 @@ bool attack_type::matches_filter(const config& filter, const std::string& check_ bool matches = matches_simple_filter(*this, filter, check_if_recursion); // Handle [and], [or], and [not] with in-order precedence - for(const auto [key, condition_cfg] : filter.all_children_range() ) + for(const auto [key, condition_cfg] : filter.all_children_view() ) { // Handle [and] if ( key == "and" ) @@ -376,7 +376,7 @@ bool attack_type::apply_modification(const config& cfg) if(del_specials.empty() == false) { const std::vector& dsl = utils::split(del_specials); config new_specials; - for(const auto [key, cfg] : specials_.all_children_range()) { + for(const auto [key, cfg] : specials_.all_children_view()) { std::vector::const_iterator found_id = std::find(dsl.begin(), dsl.end(), cfg["id"].str()); if (found_id == dsl.end()) { @@ -396,7 +396,7 @@ bool attack_type::apply_modification(const config& cfg) if(mode != "append") { specials_.clear(); } - for(const auto [key, cfg] : set_specials->all_children_range()) { + for(const auto [key, cfg] : set_specials->all_children_view()) { specials_.add_child(key, cfg); } } diff --git a/src/units/filter.cpp b/src/units/filter.cpp index 466ad0c196c..cc62b9a3109 100644 --- a/src/units/filter.cpp +++ b/src/units/filter.cpp @@ -304,7 +304,7 @@ namespace { void get_ability_children_id(std::vector& id_result, const config& parent, const std::string& id) { - for (const auto [key, cfg] : parent.all_children_range()) + for (const auto [key, cfg] : parent.all_children_view()) { if(cfg["id"] == id) { ability_match special = { key, &cfg }; @@ -782,7 +782,7 @@ void unit_filter_compound::fill(vconfig cfg) } create_child(child.second, [](const vconfig& c, const unit_filter_args& args) { if(!(c.get_parsed_config())["active"].to_bool()){ - for(const auto [key, cfg] : args.u.abilities().all_children_range()) { + for(const auto [key, cfg] : args.u.abilities().all_children_view()) { if(args.u.ability_matches_filter(cfg, key, c.get_parsed_config())) { return true; } @@ -792,7 +792,7 @@ void unit_filter_compound::fill(vconfig cfg) return false; } const unit_map& units = display::get_singleton()->get_units(); - for(const auto [key, cfg] : args.u.abilities().all_children_range()) { + for(const auto [key, cfg] : args.u.abilities().all_children_view()) { if(args.u.ability_matches_filter(cfg, key, c.get_parsed_config())) { if (args.u.get_self_ability_bool(cfg, key, args.loc)) { return true; @@ -808,7 +808,7 @@ void unit_filter_compound::fill(vconfig cfg) if (&*it == (args.u.shared_from_this()).get()) continue; - for(const auto [key, cfg] : it->abilities().all_children_range()) { + for(const auto [key, cfg] : it->abilities().all_children_view()) { if(it->ability_matches_filter(cfg, key, c.get_parsed_config())) { if (args.u.get_adj_ability_bool(cfg, key, i, args.loc, *it)) { return true; diff --git a/src/units/types.cpp b/src/units/types.cpp index e21c5ce1bbd..955898b917a 100644 --- a/src/units/types.cpp +++ b/src/units/types.cpp @@ -300,7 +300,7 @@ void unit_type::build_help_index( } if(auto abil_cfg = cfg.optional_child("abilities")) { - for(const auto [key, cfg] : abil_cfg->all_children_range()) { + for(const auto [key, cfg] : abil_cfg->all_children_view()) { abilities_.emplace_back(cfg); } } @@ -313,7 +313,7 @@ void unit_type::build_help_index( continue; } - for(const auto [key, cfg] : abil_cfg->all_children_range()) { + for(const auto [key, cfg] : abil_cfg->all_children_view()) { adv_abilities_.emplace_back(cfg); } } @@ -510,13 +510,13 @@ std::vector combine_special_notes(const std::vector direct, for(const auto& note : direct) { append_special_note(notes, note); } - for(const auto [key, cfg] : abilities.all_children_range()) { + for(const auto [key, cfg] : abilities.all_children_view()) { if(cfg.has_attribute("special_note")) { append_special_note(notes, cfg["special_note"].t_str()); } } for(const auto& attack : attacks) { - for(const auto [key, cfg] : attack.specials().all_children_range()) { + for(const auto [key, cfg] : attack.specials().all_children_view()) { if(cfg.has_attribute("special_note")) { append_special_note(notes, cfg["special_note"].t_str()); } @@ -591,7 +591,7 @@ int unit_type::experience_needed(bool with_acceleration) const bool unit_type::has_ability_by_id(const std::string& ability) const { if(auto abil = get_cfg().optional_child("abilities")) { - for(const auto [key, cfg] : abil->all_children_range()) { + for(const auto [key, cfg] : abil->all_children_view()) { if(cfg["id"] == ability) { return true; } @@ -610,7 +610,7 @@ std::vector unit_type::get_ability_list() const return res; } - for(const auto [key, cfg] : abilities->all_children_range()) { + for(const auto [key, cfg] : abilities->all_children_view()) { std::string id = cfg["id"]; if(!id.empty()) { diff --git a/src/units/unit.cpp b/src/units/unit.cpp index f5fe3c6ba98..86b851a4620 100644 --- a/src/units/unit.cpp +++ b/src/units/unit.cpp @@ -468,7 +468,7 @@ void unit::init(const config& cfg, bool use_traits, const vconfig* vcfg) events_.add_child("event", unit_event); } for(const config& abilities : cfg.child_range("abilities")) { - for(const auto [key, ability] : abilities.all_children_range()) { + for(const auto [key, ability] : abilities.all_children_view()) { for(const config& ability_event : ability.child_range("event")) { events_.add_child("event", ability_event); } @@ -476,7 +476,7 @@ void unit::init(const config& cfg, bool use_traits, const vconfig* vcfg) } for(const config& attack : cfg.child_range("attack")) { for(const config& specials : attack.child_range("specials")) { - for(const auto [key, special] : specials.all_children_range()) { + for(const auto [key, special] : specials.all_children_view()) { for(const config& special_event : special.child_range("event")) { events_.add_child("event", special_event); } @@ -1086,7 +1086,7 @@ void unit::advance_to(const unit_type& u_type, bool use_traits) events.add_child("event", unit_event); } for(const config& abilities : cfg.child_range("abilities")) { - for(const auto [key, ability] : abilities.all_children_range()) { + for(const auto [key, ability] : abilities.all_children_view()) { for(const config& ability_event : ability.child_range("event")) { events.add_child("event", ability_event); } @@ -1094,7 +1094,7 @@ void unit::advance_to(const unit_type& u_type, bool use_traits) } for(const config& attack : cfg.child_range("attack")) { for(const config& specials : attack.child_range("specials")) { - for(const auto [key, special] : specials.all_children_range()) { + for(const auto [key, special] : specials.all_children_view()) { for(const config& special_event : special.child_range("event")) { events.add_child("event", special_event); } @@ -1467,7 +1467,7 @@ void unit::set_state(const std::string& state, bool value) bool unit::has_ability_by_id(const std::string& ability) const { - for(const auto [key, cfg] : abilities_.all_children_range()) { + for(const auto [key, cfg] : abilities_.all_children_view()) { if(cfg["id"] == ability) { return true; } @@ -2071,7 +2071,7 @@ void unit::apply_builtin_effect(std::string apply_to, const config& effect) set_attr_changed(UA_ATTACKS); attacks_.emplace_back(new attack_type(effect)); for(const config& specials : effect.child_range("specials")) { - for(const auto [key, special] : specials.all_children_range()) { + for(const auto [key, special] : specials.all_children_view()) { for(const config& special_event : special.child_range("event")) { events.add_child("event", special_event); } @@ -2089,7 +2089,7 @@ void unit::apply_builtin_effect(std::string apply_to, const config& effect) for(attack_ptr a : attacks_) { a->apply_modification(effect); for(const config& specials : effect.child_range("set_specials")) { - for(const auto [key, special] : specials.all_children_range()) { + for(const auto [key, special] : specials.all_children_view()) { for(const config& special_event : special.child_range("event")) { events.add_child("event", special_event); } @@ -2251,7 +2251,7 @@ void unit::apply_builtin_effect(std::string apply_to, const config& effect) if(auto ab_effect = effect.optional_child("abilities")) { set_attr_changed(UA_ABILITIES); config to_append; - for(const auto [key, cfg] : ab_effect->all_children_range()) { + for(const auto [key, cfg] : ab_effect->all_children_view()) { if(!has_ability_by_id(cfg["id"])) { to_append.add_child(key, cfg); for(const config& event : cfg.child_range("event")) { @@ -2263,7 +2263,7 @@ void unit::apply_builtin_effect(std::string apply_to, const config& effect) } } else if(apply_to == "remove_ability") { if(auto ab_effect = effect.optional_child("abilities")) { - for(const auto [key, cfg] : ab_effect->all_children_range()) { + for(const auto [key, cfg] : ab_effect->all_children_view()) { remove_ability_by_id(cfg["id"]); } } @@ -2575,7 +2575,7 @@ void unit::apply_modifications() if(modifications_.has_child("advance")) { deprecated_message("[advance]", DEP_LEVEL::PREEMPTIVE, {1, 15, 0}, "Use [advancement] instead."); } - for(const auto [key, cfg] : modifications_.all_children_range()) { + for(const auto [key, cfg] : modifications_.all_children_view()) { add_modification(key, cfg, true); } } diff --git a/src/variable.cpp b/src/variable.cpp index ed5cdee0819..97e85256f6a 100644 --- a/src/variable.cpp +++ b/src/variable.cpp @@ -184,7 +184,7 @@ config vconfig::get_parsed_config() const res[key] = expand(key); } - for(const auto [key, cfg] : cfg_->all_children_range()) + for(const auto [key, cfg] : cfg_->all_children_view()) { if (key == "insert_tag") { vconfig insert_cfg(cfg, *variables_); @@ -227,7 +227,7 @@ vconfig::child_list vconfig::get_children(const std::string& key_to_get) const { vconfig::child_list res; - for(const auto [key, cfg] : cfg_->all_children_range()) + for(const auto [key, cfg] : cfg_->all_children_view()) { if (key == key_to_get) { res.push_back(vconfig(cfg, cache_, *variables_)); @@ -257,7 +257,7 @@ std::size_t vconfig::count_children(const std::string& key_to_count) const { std::size_t n = 0; - for(const auto [key, cfg] : cfg_->all_children_range()) + for(const auto [key, cfg] : cfg_->all_children_view()) { if (key == key_to_count) { n++; diff --git a/src/wesnoth.cpp b/src/wesnoth.cpp index 064ac751030..70e3ca1ed44 100644 --- a/src/wesnoth.cpp +++ b/src/wesnoth.cpp @@ -147,7 +147,7 @@ static void handle_preprocess_command(const commandline_options& cmdline_opts) int read = 0; // use static preproc_define::read_pair(config) to make a object - for(const auto [_, cfg] : cfg.all_children_range()) { + for(const auto [_, cfg] : cfg.all_children_view()) { const preproc_map::value_type def = preproc_define::read_pair(cfg); input_macros[def.first] = def.second; ++read;