From cb9d69aff4a37c8325b2c126e243812f2d91cfeb Mon Sep 17 00:00:00 2001 From: Chris Beck Date: Sat, 22 Feb 2014 01:50:17 -0500 Subject: [PATCH] create blindfold_replay preference with checkbox in lobby --- src/game_preferences.cpp | 10 ++++++++++ src/game_preferences.hpp | 3 +++ src/multiplayer_lobby.cpp | 10 +++++++++- src/multiplayer_lobby.hpp | 1 + 4 files changed, 23 insertions(+), 1 deletion(-) diff --git a/src/game_preferences.cpp b/src/game_preferences.cpp index 26e55d709dff..5976afd64c22 100644 --- a/src/game_preferences.cpp +++ b/src/game_preferences.cpp @@ -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); diff --git a/src/game_preferences.hpp b/src/game_preferences.hpp index a81503f60793..d55a2f7084b2 100644 --- a/src/game_preferences.hpp +++ b/src/game_preferences.hpp @@ -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(); diff --git a/src/multiplayer_lobby.cpp b/src/multiplayer_lobby.cpp index 3b40b4b32ae2..b2bb99e3b59d 100644 --- a/src/multiplayer_lobby.cpp +++ b/src/multiplayer_lobby.cpp @@ -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), @@ -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.")); @@ -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); @@ -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 @@ -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); diff --git a/src/multiplayer_lobby.hpp b/src/multiplayer_lobby.hpp index d916e4685ef2..4b02c58a0ba3 100644 --- a/src/multiplayer_lobby.hpp +++ b/src/multiplayer_lobby.hpp @@ -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_;