Skip to content

Commit

Permalink
fixup some mp configure UI associated to the random factions option
Browse files Browse the repository at this point in the history
  • Loading branch information
cbeck88 committed Mar 13, 2015
1 parent bf5fd17 commit 8fffc85
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/game_initialization/multiplayer_configure.cpp
Expand Up @@ -84,6 +84,7 @@ configure::configure(game_display& disp, const config &cfg, chat& c, config& gam
observers_game_(disp.video(), _("Observers"), gui::button::TYPE_CHECK),
oos_debug_(disp.video(), _("Debug OOS"), gui::button::TYPE_CHECK),
shuffle_sides_(disp.video(), _("Shuffle sides"), gui::button::TYPE_CHECK),
random_faction_mode_label_(disp.video(), _("Random Factions:"), font::SIZE_SMALL, font::LOBBY_COLOR),
random_faction_mode_(disp, std::vector<std::string>()),
cancel_game_(disp.video(), _("Back")),
launch_game_(disp.video(), _("OK")),
Expand Down Expand Up @@ -186,14 +187,16 @@ configure::configure(game_display& disp, const config &cfg, chat& c, config& gam
shuffle_sides_.set_check(engine_.shuffle_sides_default());
shuffle_sides_.set_help_string(_("Assign sides to players at random"));

random_faction_mode_label_.set_help_string(_("Allow for mirror matchups when random factions are chosen"));

std::vector<std::string> translated_modes;
for(size_t i = 0; i < mp_game_settings::RANDOM_FACTION_MODE_COUNT; ++i) {
std::string mode_str = mp_game_settings::RANDOM_FACTION_MODE_to_string(static_cast<mp_game_settings::RANDOM_FACTION_MODE> (i));
translated_modes.push_back(translation::gettext(mode_str.c_str()));
}
random_faction_mode_.set_items(translated_modes);
random_faction_mode_.set_selected(engine_.random_faction_mode());
random_faction_mode_.set_help_string(_("Independent: Random factions assigned independently uniformly at random\nNo Mirror: No two players will get the same faction\nNo Ally Mirror: No two allied players will get the same faction"));
random_faction_mode_.set_help_string(_("Independent: Random factions assigned independently\nNo Mirror: No two players will get the same faction\nNo Ally Mirror: No two allied players will get the same faction"));

#if 0
// The possible vision settings
Expand Down Expand Up @@ -497,6 +500,7 @@ void configure::hide_children(bool hide)
observers_game_.hide(hide);
oos_debug_.hide(hide);
shuffle_sides_.hide(hide);
random_faction_mode_label_.hide(hide);
random_faction_mode_.hide(hide);
cancel_game_.hide(hide);
launch_game_.hide(hide);
Expand Down Expand Up @@ -549,23 +553,28 @@ void configure::layout_children(const SDL_Rect& rect)

int slider_width = options_pane_left_.width() - 40;

int xpos_left = 0;
int ypos_left = 0;
unsigned int xpos_left = 0;
unsigned int ypos_left = 0;

ypos_left += 2 * border_size;
options_pane_left_.add_widget(&shuffle_sides_, xpos_left, ypos_left);
options_pane_left_.add_widget(&observers_game_,
xpos_left + (options_pane_left_.width() - xpos_left) / 2 + border_size, ypos_left);
ypos_left += shuffle_sides_.height() + border_size;

options_pane_left_.add_widget(&random_faction_mode_label_, xpos_left, ypos_left);
xpos_left += random_faction_mode_label_.width() + border_size;

options_pane_left_.add_widget(&random_faction_mode_, xpos_left, ypos_left);
xpos_left += random_faction_mode_.width() + border_size;

if(!local_players_only_) {
options_pane_left_.add_widget(&password_button_,
(ca.x + first_column_width / 2) - 40, ypos_left);
std::max(xpos_left + 2* border_size, (options_pane_left_.width() / 2) + border_size), ypos_left);
} else {
password_button_.hide(true);
}
xpos_left = 0;
ypos_left += random_faction_mode_.height() + border_size;

options_pane_left_.add_widget(&countdown_game_, xpos_left, ypos_left);
Expand Down
1 change: 1 addition & 0 deletions src/game_initialization/multiplayer_configure.hpp
Expand Up @@ -79,6 +79,7 @@ class configure : public mp::ui
gui::button observers_game_;
gui::button oos_debug_;
gui::button shuffle_sides_;
gui::label random_faction_mode_label_;
gui::combo random_faction_mode_;

gui::button cancel_game_;
Expand Down

0 comments on commit 8fffc85

Please sign in to comment.