Skip to content

Commit

Permalink
create blindfold_replay preference with checkbox in lobby
Browse files Browse the repository at this point in the history
  • Loading branch information
cbeck88 committed Feb 22, 2014
1 parent 9e4fd80 commit cb9d69a
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 1 deletion.
10 changes: 10 additions & 0 deletions src/game_preferences.cpp
Expand Up @@ -652,6 +652,16 @@ void set_skip_mp_replay(bool value)
preferences::set("skip_mp_replay", value);
}

bool blindfold_replay()
{
return preferences::get("blindfold_replay", false);
}

void set_blindfold_replay(bool value)
{
preferences::set("blindfold_replay", value);
}

bool countdown()
{
return preferences::get("mp_countdown", false);
Expand Down
3 changes: 3 additions & 0 deletions src/game_preferences.hpp
Expand Up @@ -151,6 +151,9 @@ class acquaintance;
bool skip_mp_replay();
void set_skip_mp_replay(bool value);

bool blindfold_replay();
void set_blindfold_replay(bool value);

bool countdown();
void set_countdown(bool value);
int countdown_init_time();
Expand Down
10 changes: 9 additions & 1 deletion src/multiplayer_lobby.cpp
Expand Up @@ -859,6 +859,7 @@ lobby::lobby(game_display& disp, const config& cfg, chat& c, config& gamelist) :
join_game_(disp.video(), _("Join Game")),
create_game_(disp.video(), _("Create Game")),
skip_replay_(disp.video(), _("Quick replays"), gui::button::TYPE_CHECK),
blindfold_(disp.video(), _("Enter blindfolded"), gui::button::TYPE_CHECK),
game_preferences_(disp.video(), _("Preferences")),
quit_game_(disp.video(), _("Quit")),
apply_filter_(disp.video(), _("Apply filter"), gui::button::TYPE_CHECK),
Expand All @@ -875,6 +876,9 @@ lobby::lobby(game_display& disp, const config& cfg, chat& c, config& gamelist) :
skip_replay_.set_check(preferences::skip_mp_replay());
skip_replay_.set_help_string(_("Skip quickly to the active turn when observing"));

blindfold_.set_check(preferences::blindfold_replay());
blindfold_.set_help_string(_("Don't show the turns of replay"));

apply_filter_.set_check(preferences::filter_lobby());
apply_filter_.set_help_string(_("Enable the games filter. If unchecked all games are shown, regardless of any filter."));

Expand Down Expand Up @@ -909,6 +913,7 @@ void lobby::hide_children(bool hide)
join_game_.hide(hide);
create_game_.hide(hide);
skip_replay_.hide(hide);
blindfold_.hide(hide);
game_preferences_.hide(hide);
quit_game_.hide(hide);
apply_filter_.hide(hide);
Expand Down Expand Up @@ -940,7 +945,8 @@ void lobby::layout_children(const SDL_Rect& rect)
- skip_replay_.location().w - game_preferences_.location().w - btn_space) / 2;
if (space < btn_space) space = btn_space;
skip_replay_.set_location(create_game_.location().x + create_game_.location().w + space, yscale(yborder));
game_preferences_.set_location(quit_game_.location().x - game_preferences_.location().w - space, yscale(yborder));
blindfold_.set_location(quit_game_.location().x - game_preferences_.location().w - space , yscale(yborder));
game_preferences_.set_location(quit_game_.location().x - game_preferences_.location().w - space + blindfold_.location().w, yscale(yborder));

games_menu_.set_location(client_area().x, client_area().y + title().height());
games_menu_.set_measurements(client_area().w, client_area().h
Expand Down Expand Up @@ -980,6 +986,8 @@ void lobby::process_event()
const bool join = (join_game_.pressed() || games_menu_.selected()) && games_menu_.selection_is_joinable();
games_menu_.reset_selection();
preferences::set_skip_mp_replay(skip_replay_.checked());
preferences::set_blindfold_replay(blindfold_.checked());

playmp_controller::set_replay_last_turn(0);
preferences::set_message_private(false);

Expand Down
1 change: 1 addition & 0 deletions src/multiplayer_lobby.hpp
Expand Up @@ -187,6 +187,7 @@ class lobby : public ui
gui::button join_game_;
gui::button create_game_;
gui::button skip_replay_;
gui::button blindfold_;
gui::button game_preferences_;
gui::button quit_game_;

Expand Down

0 comments on commit cb9d69a

Please sign in to comment.