Cleaned up unnecessary instances of emplace_back(config {})
No need to invoke the copy ctor.
This commit is contained in:
parent
2e502334f2
commit
c2fd4f48f9
15 changed files with 40 additions and 40 deletions
|
@ -353,7 +353,7 @@ void controller_base::show_menu(
|
|||
const hotkey::hotkey_command& command = hotkey::get_hotkey_command(id);
|
||||
|
||||
if(cmd_exec->can_execute_command(command) && (!context_menu || in_context_menu(command.id))) {
|
||||
items.emplace_back(config{"id", id});
|
||||
items.emplace_back("id", id);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -649,7 +649,7 @@ bool editor_controller::do_execute_command(const hotkey::hotkey_command& cmd, in
|
|||
sound::play_music_once(music_tracks_[index].id());
|
||||
get_current_map_context().add_to_playlist(music_tracks_[index]);
|
||||
std::vector<config> items;
|
||||
items.emplace_back(config {"id", "editor-playlist"});
|
||||
items.emplace_back("id", "editor-playlist");
|
||||
std::shared_ptr<gui::button> b = gui_->find_menu_button("menu-playlist");
|
||||
show_menu(items, b->location().x +1, b->location().y + b->height() +1, false, *gui_);
|
||||
return true;
|
||||
|
@ -1011,7 +1011,7 @@ void editor_controller::show_menu(const std::vector<config>& items_arg, int xloc
|
|||
if((can_execute_command(command) && (!context_menu || in_context_menu(command.id)))
|
||||
|| command.id == hotkey::HOTKEY_NULL)
|
||||
{
|
||||
items.emplace_back(config {"id", id});
|
||||
items.emplace_back("id", id);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -310,7 +310,7 @@ void context_manager::expand_open_maps_menu(std::vector<config>& items, int i)
|
|||
const std::string label = ss.str();
|
||||
const std::string details = get_menu_marker(changed);
|
||||
|
||||
contexts.emplace_back(config {"label", label, "details", details});
|
||||
contexts.emplace_back("label", label, "details", details);
|
||||
}
|
||||
|
||||
items.insert(pos, contexts.begin(), contexts.end());
|
||||
|
@ -373,7 +373,7 @@ void context_manager::expand_areas_menu(std::vector<config>& items, int i)
|
|||
const std::string label = ss.str();
|
||||
const std::string details = get_menu_marker(changed);
|
||||
|
||||
area_entries.emplace_back(config {"label", label, "details", details});
|
||||
area_entries.emplace_back("label", label, "details", details);
|
||||
}
|
||||
|
||||
items.insert(pos, area_entries.begin(), area_entries.end());
|
||||
|
@ -397,7 +397,7 @@ void context_manager::expand_sides_menu(std::vector<config>& items, int i)
|
|||
label << teamname;
|
||||
}
|
||||
|
||||
contexts.emplace_back(config {"label", label.str()});
|
||||
contexts.emplace_back("label", label.str());
|
||||
}
|
||||
|
||||
items.insert(pos, contexts.begin(), contexts.end());
|
||||
|
@ -413,10 +413,10 @@ void context_manager::expand_time_menu(std::vector<config>& items, int i)
|
|||
assert(tod_m != nullptr);
|
||||
|
||||
for(const time_of_day& time : tod_m->times()) {
|
||||
times.emplace_back(config {
|
||||
times.emplace_back(
|
||||
"details", time.name, // Use 'details' field here since the image will take the first column
|
||||
"image", time.image,
|
||||
});
|
||||
"image", time.image
|
||||
);
|
||||
}
|
||||
|
||||
items.insert(pos, times.begin(), times.end());
|
||||
|
@ -430,10 +430,10 @@ void context_manager::expand_local_time_menu(std::vector<config>& items, int i)
|
|||
tod_manager* tod_m = get_map_context().get_time_manager();
|
||||
|
||||
for(const time_of_day& time : tod_m->times(get_map_context().get_active_area())) {
|
||||
times.emplace_back(config {
|
||||
times.emplace_back(
|
||||
"details", time.name, // Use 'details' field here since the image will take the first column
|
||||
"image", time.image,
|
||||
});
|
||||
"image", time.image
|
||||
);
|
||||
}
|
||||
|
||||
items.insert(pos, times.begin(), times.end());
|
||||
|
|
|
@ -62,10 +62,10 @@ void editor_palette<Item>::expand_palette_groups_menu(std::vector<config>& items
|
|||
img += ".png";
|
||||
}
|
||||
|
||||
groups.emplace_back(config {
|
||||
groups.emplace_back(
|
||||
"label", groupname,
|
||||
"icon", img,
|
||||
});
|
||||
"icon", img
|
||||
);
|
||||
}
|
||||
|
||||
items.insert(pos, groups.begin(), groups.end());
|
||||
|
|
|
@ -711,7 +711,7 @@ WML_HANDLER_FUNCTION(set_variables,, cfg)
|
|||
|
||||
for(std::vector<std::string>::iterator i=split_vector.begin(); i!=split_vector.end(); ++i)
|
||||
{
|
||||
data.emplace_back(config {key_name, *i});
|
||||
data.emplace_back(key_name, *i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -130,7 +130,7 @@ void wmi_manager::get_items(const map_location& hex,
|
|||
&& item->can_show(hex, gamedata, fc)) {
|
||||
// Include this item.
|
||||
items.push_back(item);
|
||||
descriptions.emplace_back(config {"id", item->menu_text()});
|
||||
descriptions.emplace_back("id", item->menu_text());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -333,7 +333,7 @@ void addon_manager::pre_show(window& window)
|
|||
|
||||
std::vector<config> status_filter_entries;
|
||||
for(const auto& f : status_filter_types_) {
|
||||
status_filter_entries.emplace_back(config {"label", t_string(f.second, GETTEXT_DOMAIN)});
|
||||
status_filter_entries.emplace_back("label", t_string(f.second, GETTEXT_DOMAIN));
|
||||
}
|
||||
|
||||
status_filter.set_values(status_filter_entries);
|
||||
|
@ -343,7 +343,7 @@ void addon_manager::pre_show(window& window)
|
|||
|
||||
std::vector<config> type_filter_entries;
|
||||
for(const auto& f : type_filter_types_) {
|
||||
type_filter_entries.emplace_back(config {"label", t_string(f.second, GETTEXT_DOMAIN), "checkbox", false});
|
||||
type_filter_entries.emplace_back("label", t_string(f.second, GETTEXT_DOMAIN), "checkbox", false);
|
||||
}
|
||||
|
||||
type_filter.set_values(type_filter_entries);
|
||||
|
|
|
@ -260,7 +260,7 @@ void campaign_selection::pre_show(window& window)
|
|||
for(const auto& mod : engine_.get_const_extras_by_type(ng::create_engine::MOD)) {
|
||||
const bool active = std::find(enabled.begin(), enabled.end(), mod->id) != enabled.end();
|
||||
|
||||
mod_menu_values.emplace_back(config {"label", mod->name, "checkbox", active});
|
||||
mod_menu_values.emplace_back("label", mod->name, "checkbox", active);
|
||||
|
||||
mod_states_.push_back(active);
|
||||
}
|
||||
|
|
|
@ -146,13 +146,13 @@ void faction_select::on_faction_select(window& window)
|
|||
|
||||
if(unit) {
|
||||
const std::string icon = formatter() << unit->image() << "~RC(" << unit->flag_rgb() << ">" << tc_color_ << ")";
|
||||
leaders.emplace_back(config {"label", unit->type_name(), "icon", icon});
|
||||
leaders.emplace_back("label", unit->type_name(), "icon", icon);
|
||||
} else if(leader == "random") {
|
||||
leaders.emplace_back(config {"label", _("Random"), "icon", ng::random_enemy_picture});
|
||||
leaders.emplace_back("label", _("Random"), "icon", ng::random_enemy_picture);
|
||||
} else if(leader == "null") {
|
||||
leaders.emplace_back(config {"label", font::unicode_em_dash});
|
||||
leaders.emplace_back("label", font::unicode_em_dash);
|
||||
} else {
|
||||
leaders.emplace_back(config {"label", "?"});
|
||||
leaders.emplace_back("label", "?");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -180,7 +180,7 @@ void mp_create_game::pre_show(window& win)
|
|||
//
|
||||
std::vector<config> game_types;
|
||||
for(level_type_info& type_info : level_types_) {
|
||||
game_types.emplace_back(config {"label", type_info.second});
|
||||
game_types.emplace_back("label", type_info.second);
|
||||
}
|
||||
|
||||
if(game_types.empty()) {
|
||||
|
@ -246,7 +246,7 @@ void mp_create_game::pre_show(window& win)
|
|||
|
||||
std::vector<config> era_names;
|
||||
for(const auto& era : create_engine_.get_const_extras_by_type(ng::create_engine::ERA)) {
|
||||
era_names.emplace_back(config {"label", era->name, "tooltip", era->description});
|
||||
era_names.emplace_back("label", era->name, "tooltip", era->description);
|
||||
}
|
||||
|
||||
if(era_names.empty()) {
|
||||
|
@ -269,9 +269,9 @@ void mp_create_game::pre_show(window& win)
|
|||
//
|
||||
std::vector<config> rfm_options;
|
||||
for(const auto& type : rfm_types_) {
|
||||
rfm_options.emplace_back(config {"label",
|
||||
rfm_options.emplace_back("label",
|
||||
translation::sgettext(mp_game_settings::RANDOM_FACTION_MODE::enum_to_string(type).c_str())
|
||||
});
|
||||
);
|
||||
};
|
||||
|
||||
// Manually insert tooltips. Need to find a better way to do this
|
||||
|
|
|
@ -197,7 +197,7 @@ void mp_staging::add_side_node(window& window, ng::side_engine_ptr side)
|
|||
// We use an index-based loop in order to get the index of the selected option
|
||||
std::vector<config> ai_options;
|
||||
for(unsigned i = 0; i < ai_algorithms_.size(); ++i) {
|
||||
ai_options.emplace_back(config {"label", ai_algorithms_[i]->text});
|
||||
ai_options.emplace_back("label", ai_algorithms_[i]->text);
|
||||
|
||||
if(ai_algorithms_[i]->id == side->ai_algorithm()) {
|
||||
selection = i;
|
||||
|
@ -216,7 +216,7 @@ void mp_staging::add_side_node(window& window, ng::side_engine_ptr side)
|
|||
//
|
||||
std::vector<config> controller_names;
|
||||
for(const auto& controller : side->controller_options()) {
|
||||
controller_names.emplace_back(config {"label", controller.second});
|
||||
controller_names.emplace_back("label", controller.second);
|
||||
}
|
||||
|
||||
menu_button& controller_selection = find_widget<menu_button>(&row_grid, "controller", false);
|
||||
|
@ -279,10 +279,10 @@ void mp_staging::add_side_node(window& window, ng::side_engine_ptr side)
|
|||
//
|
||||
std::vector<config> color_options;
|
||||
for(const auto& color : side->color_options()) {
|
||||
color_options.emplace_back(config {
|
||||
color_options.emplace_back(
|
||||
"label", font::get_color_string_pango(color),
|
||||
"icon", (formatter() << "misc/status.png~RC(magenta>" << color << ")").str(),
|
||||
});
|
||||
"icon", (formatter() << "misc/status.png~RC(magenta>" << color << ")").str()
|
||||
);
|
||||
}
|
||||
|
||||
menu_button& color_selection = find_widget<menu_button>(&row_grid, "side_color", false);
|
||||
|
@ -504,7 +504,7 @@ void mp_staging::network_handler(window& window)
|
|||
|
||||
std::vector<config> controller_names;
|
||||
for(const auto& controller : side->controller_options()) {
|
||||
controller_names.emplace_back(config {"label", controller.second});
|
||||
controller_names.emplace_back("label", controller.second);
|
||||
}
|
||||
|
||||
menu_button& controller_selection = find_widget<menu_button>(&row_grid, "controller", false);
|
||||
|
|
|
@ -745,7 +745,7 @@ void preferences_dialog::post_build(window& window)
|
|||
|
||||
std::vector<config> hotkey_category_entries;
|
||||
for(const auto& name : cat_names_) {
|
||||
hotkey_category_entries.emplace_back(config {"label", name, "checkbox", false});
|
||||
hotkey_category_entries.emplace_back("label", name, "checkbox", false);
|
||||
}
|
||||
|
||||
multimenu_button& hotkey_menu = find_widget<multimenu_button>(&window, "hotkey_category_menu", false);
|
||||
|
|
|
@ -65,7 +65,7 @@ void statistics_dialog::pre_show(window& window)
|
|||
//
|
||||
std::vector<config> menu_items;
|
||||
for(const auto& scenario : scenarios_) {
|
||||
menu_items.emplace_back(config {"label", *scenario.first});
|
||||
menu_items.emplace_back("label", *scenario.first);
|
||||
}
|
||||
|
||||
menu_button& scenario_menu = find_widget<menu_button>(&window, "scenario_menu", false);
|
||||
|
|
|
@ -404,13 +404,13 @@ void play_controller::hotkey_handler::expand_autosaves(std::vector<config>& item
|
|||
|
||||
if(savegame::save_game_exists(name, comp_format)) {
|
||||
newsaves.emplace_back(name + compression::format_extension(comp_format));
|
||||
newitems.emplace_back(config {"label", _("Back to Turn ") + std::to_string(turn)});
|
||||
newitems.emplace_back("label", _("Back to Turn ") + std::to_string(turn));
|
||||
}
|
||||
}
|
||||
|
||||
if(savegame::save_game_exists(start_name, comp_format)) {
|
||||
newsaves.emplace_back(start_name + compression::format_extension(comp_format));
|
||||
newitems.emplace_back(config {"label", _("Back to Start")});
|
||||
newitems.emplace_back("label", _("Back to Start"));
|
||||
}
|
||||
|
||||
// Make sure list doesn't get too long: keep top two, midpoint and bottom.
|
||||
|
@ -449,7 +449,7 @@ void play_controller::hotkey_handler::show_menu(const std::vector<config>& items
|
|||
const hotkey::hotkey_command& command = hotkey::get_hotkey_command(id);
|
||||
|
||||
if(id == "wml" || (can_execute_command(command) && (!context_menu || in_context_menu(command.id)))) {
|
||||
items.emplace_back(config {"id", id});
|
||||
items.emplace_back("id", id);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -504,7 +504,7 @@ theme::menu::menu(const config& cfg)
|
|||
, items_()
|
||||
{
|
||||
for(const auto& item : utils::split(cfg["items"])) {
|
||||
items_.emplace_back(config {"id", item});
|
||||
items_.emplace_back("id", item);
|
||||
}
|
||||
|
||||
if(cfg["auto_tooltip"].to_bool() && tooltip_.empty() && items_.size() == 1) {
|
||||
|
|
Loading…
Add table
Reference in a new issue