Skip to content

Commit f0a1eb1

Browse files
committed
add the rest
1 parent b931d32 commit f0a1eb1

1 file changed

Lines changed: 19 additions & 11 deletions

File tree

src/server/wesnothd/server.cpp

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1668,6 +1668,21 @@ void server::handle_join_game(player_iterator player, simple_wml::node& join)
16681668
}
16691669
}
16701670

1671+
void setup_queue_options(const std::string& type, const config& qoptions, simple_wml::node& game)
1672+
{
1673+
for(const config& option_type : qoptions.child_range("multiplayer")) {
1674+
simple_wml::node& options = game.add_child("options");
1675+
simple_wml::node& type = options.add_child("multiplayer");
1676+
type.set_attr_dup("id", option_type["id"].str().c_str());
1677+
1678+
for(const config& qoption : option_type.child_range("option")) {
1679+
simple_wml::node& option = type.add_child("option");
1680+
option.set_attr_dup("id", qoption["id"].str().c_str());
1681+
option.set_attr_dup("value", qoption["value"].str().c_str());
1682+
}
1683+
}
1684+
}
1685+
16711686
void server::handle_join_server_queue(player_iterator p, simple_wml::node& data)
16721687
{
16731688
int queue_id = data.attr("queue_id").to_int();
@@ -1722,17 +1737,10 @@ void server::handle_join_server_queue(player_iterator p, simple_wml::node& data)
17221737
game.set_attr_dup("modifications", queue.settings["modifications"].str().c_str());
17231738

17241739
for(const config& qoptions : queue.settings.child_range("options")) {
1725-
for(const config& option_type : qoptions.child_range("multiplayer")) {
1726-
simple_wml::node& options = game.add_child("options");
1727-
simple_wml::node& type = options.add_child("multiplayer");
1728-
type.set_attr_dup("id", option_type["id"].str().c_str());
1729-
1730-
for(const config& qoption : option_type.child_range("option")) {
1731-
simple_wml::node& option = type.add_child("option");
1732-
option.set_attr_dup("id", qoption["id"].str().c_str());
1733-
option.set_attr_dup("value", qoption["value"].str().c_str());
1734-
}
1735-
}
1740+
setup_queue_options("multiplayer", qoptions, game);
1741+
setup_queue_options("era", qoptions, game);
1742+
setup_queue_options("modification", qoptions, game);
1743+
setup_queue_options("campaign", qoptions, game);
17361744
}
17371745

17381746
// tell the final player to create and host the game

0 commit comments

Comments
 (0)