diff --git a/src/gui/dialogs/multiplayer/mp_options_helper.cpp b/src/gui/dialogs/multiplayer/mp_options_helper.cpp index 3eb7a82c558e..290b1fe429d8 100644 --- a/src/gui/dialogs/multiplayer/mp_options_helper.cpp +++ b/src/gui/dialogs/multiplayer/mp_options_helper.cpp @@ -78,6 +78,11 @@ void tmp_options_helper::update_options_data_map(ttoggle_button* widget, const o options_data_[source][widget->id()] = widget->get_value_bool(); } +void tmp_options_helper::update_options_data_map_menu_button(tmenu_button* widget, const option_source& source, const config& cfg) +{ + options_data_[source][widget->id()] = cfg.child_range("item")[widget->get_value()]["value"].str(); +} + void tmp_options_helper::reset_options_data(const option_source& source, bool& handled, bool& halt) { options_data_[source].clear(); @@ -193,7 +198,7 @@ void tmp_options_helper::display_custom_options(std::string&& type, const config } menu_button->connect_click_handler( - std::bind(&tmp_options_helper::update_options_data_map, this, menu_button, visible_options_.back())); + std::bind(&tmp_options_helper::update_options_data_map_menu_button, this, menu_button, visible_options_.back(), option_cfg)); } else if(opt.key == "slider") { add_name("slider_label"); diff --git a/src/gui/dialogs/multiplayer/mp_options_helper.hpp b/src/gui/dialogs/multiplayer/mp_options_helper.hpp index 236a4823f7bd..3d6d67af7363 100644 --- a/src/gui/dialogs/multiplayer/mp_options_helper.hpp +++ b/src/gui/dialogs/multiplayer/mp_options_helper.hpp @@ -23,6 +23,7 @@ namespace gui2 { class tcontrol; +class tmenu_button; class ttoggle_button; class ttree_view; class ttree_view_node; @@ -58,6 +59,9 @@ class tmp_options_helper void update_options_data_map(T* widget, const option_source& source); void update_options_data_map(ttoggle_button* widget, const option_source& source); + // NOTE: this cannot be an overload of update_options_data_map since that's a templated function + void update_options_data_map_menu_button(tmenu_button* widget, const option_source& source, const config& cfg); + void reset_options_data(const option_source& source, bool& handled, bool& halt); ttree_view& options_tree_;