From 796f535de36926de37e4ac702ed615c9c0d893ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Rosen?= Date: Sat, 5 Aug 2006 10:17:48 +0000 Subject: [PATCH] greying out of top menu when the info is not valid (i.e it's not your turn) --- changelog | 1 + data/about.cfg | 1 + src/font.cpp | 1 + src/font.hpp | 2 +- src/marked-up_text.cpp | 5 ++++- src/marked-up_text.hpp | 2 +- src/play_controller.cpp | 3 +-- src/reports.cpp | 16 +++++++++------- 8 files changed, 19 insertions(+), 12 deletions(-) diff --git a/changelog b/changelog index 4d666503607..16966d7edef 100644 --- a/changelog +++ b/changelog @@ -11,6 +11,7 @@ Version 1.3-svn: * user interface * disable inactive sliders instead of hiding them * sliders can be adjusted with keyboard left and right + * sidebar reports related to gold, units, villages, and time grey out during other team's turns * WML engine * allow_new_game key (default=yes) to prevent [multiplayer] scenarios to show up in the multiplayer game creation interface (FR #6397) diff --git a/data/about.cfg b/data/about.cfg index a8adef0ec3f..6e90ef17180 100644 --- a/data/about.cfg +++ b/data/about.cfg @@ -546,6 +546,7 @@ Joshua Hudson Paul Smedley (Creeping) Andrea Palmatè (afxgroup) EdB +Jim Carroll (Jimm) " [/about] diff --git a/src/font.cpp b/src/font.cpp index 75075ccc367..6a2d6b1c283 100644 --- a/src/font.cpp +++ b/src/font.cpp @@ -321,6 +321,7 @@ void set_font_list(const std::vector& fontlist) } const SDL_Color NORMAL_COLOUR = {0xDD,0xDD,0xDD,0}, + GRAY_COLOUR = {0x55,0x55,0x55,0}, LOBBY_COLOUR = {0xBB,0xBB,0xBB,0}, GOOD_COLOUR = {0x00,0xFF,0x00,0}, BAD_COLOUR = {0xFF,0x00,0x00,0}, diff --git a/src/font.hpp b/src/font.hpp index 1393989c735..2be4df82db1 100644 --- a/src/font.hpp +++ b/src/font.hpp @@ -44,7 +44,7 @@ struct subset_descriptor void set_font_list(const std::vector& fontlist); //various standard colours -extern const SDL_Color NORMAL_COLOUR, LOBBY_COLOUR, GOOD_COLOUR, BAD_COLOUR, +extern const SDL_Color NORMAL_COLOUR, GRAY_COLOUR, LOBBY_COLOUR, GOOD_COLOUR, BAD_COLOUR, BLACK_COLOUR, DARK_COLOUR, YELLOW_COLOUR, BUTTON_COLOUR, STONED_COLOUR, TITLE_COLOUR, DISABLED_COLOUR; diff --git a/src/marked-up_text.cpp b/src/marked-up_text.cpp index 490506a0df5..b50e3f9c9c2 100644 --- a/src/marked-up_text.cpp +++ b/src/marked-up_text.cpp @@ -22,7 +22,7 @@ namespace font { const char LARGE_TEXT='*', SMALL_TEXT='`', GOOD_TEXT='@', BAD_TEXT='#', NORMAL_TEXT='{', BLACK_TEXT='}', BOLD_TEXT='~', IMAGE='&', - COLOR_TEXT='<', NULL_MARKUP='^'; + COLOR_TEXT='<', NULL_MARKUP='^', GRAY_TEXT='|'; namespace { @@ -53,6 +53,9 @@ std::string::const_iterator parse_markup(std::string::const_iterator i1, std::st case BLACK_TEXT: *colour = BLACK_COLOUR; break; + case GRAY_TEXT: + *colour = GRAY_COLOUR; + break; case LARGE_TEXT: *font_size += 2; break; diff --git a/src/marked-up_text.hpp b/src/marked-up_text.hpp index 36df05d377c..796f188c48c 100644 --- a/src/marked-up_text.hpp +++ b/src/marked-up_text.hpp @@ -21,7 +21,7 @@ class CVideo; namespace font { //standard markups -extern const char LARGE_TEXT, SMALL_TEXT, GOOD_TEXT, BAD_TEXT, NORMAL_TEXT, BLACK_TEXT, BOLD_TEXT, IMAGE, NULL_MARKUP; +extern const char LARGE_TEXT, SMALL_TEXT, GOOD_TEXT, BAD_TEXT, NORMAL_TEXT, GRAY_TEXT, BLACK_TEXT, BOLD_TEXT, IMAGE, NULL_MARKUP; //function to draw text on the screen. The text will be clipped to area. diff --git a/src/play_controller.cpp b/src/play_controller.cpp index 3f616e22deb..042dc1b1ff3 100644 --- a/src/play_controller.cpp +++ b/src/play_controller.cpp @@ -291,6 +291,7 @@ void play_controller::init_side(const unsigned int team_index, bool is_replay){ if(team_manager_.is_observer()) { gui_->set_team(size_t(team_index)); } + gui_->set_playing_team(size_t(team_index)); std::stringstream player_number_str; player_number_str << player_number_; @@ -348,8 +349,6 @@ void play_controller::init_side(const unsigned int team_index, bool is_replay){ current_team.set_time_of_day(int(status_.turn()),status_.get_time_of_day()); - gui_->set_playing_team(size_t(team_index)); - if (!recorder.is_skipping()){ ::clear_shroud(*gui_,status_,map_,gameinfo_,units_,teams_,team_index); } diff --git a/src/reports.cpp b/src/reports.cpp index de466f2df23..672e5590d9b 100644 --- a/src/reports.cpp +++ b/src/reports.cpp @@ -342,32 +342,32 @@ Units cannot be killed by poison alone. The poison will not reduce it below 1 HP str << "\n"; break; + // For these following status reports, show them in gray text when it is not the active player's turn. case GOLD: - str << (current_team.gold() < 0 ? font::BAD_TEXT : font::NULL_MARKUP) << current_team.gold(); + str << (current_side != playing_side ? font::GRAY_TEXT : (current_team.gold() < 0 ? font::BAD_TEXT : font::NULL_MARKUP)) << current_team.gold(); break; case VILLAGES: { const team_data data = calculate_team_data(current_team,current_side,units); - str << data.villages; - + str << (current_side != playing_side ? font::GRAY_TEXT : font::NULL_MARKUP) << data.villages; break; } case NUM_UNITS: { - str << team_units(units,current_side); + str << (current_side != playing_side ? font::GRAY_TEXT : font::NULL_MARKUP) << team_units(units,current_side); break; } case UPKEEP: { const team_data data = calculate_team_data(current_team,current_side,units); - str << data.expenses << " (" << data.upkeep << ")"; + str << (current_side != playing_side ? font::GRAY_TEXT : font::NULL_MARKUP) << data.expenses << " (" << data.upkeep << ")"; break; } case EXPENSES: { const team_data data = calculate_team_data(current_team,current_side,units); - str << data.expenses; + str << (current_side != playing_side ? font::GRAY_TEXT : font::NULL_MARKUP) << data.expenses; break; } case INCOME: { const team_data data = calculate_team_data(current_team,current_side,units); - str << (data.net_income < 0 ? font::BAD_TEXT : font::NULL_MARKUP) << data.net_income; + str << (current_side != playing_side ? font::GRAY_TEXT : (data.net_income < 0 ? font::BAD_TEXT : font::NULL_MARKUP)) << data.net_income; break; } case TERRAIN: { @@ -494,6 +494,8 @@ Units cannot be killed by poison alone. The poison will not reduce it below 1 HP if (current_team.countdown_time() > 0){ sec = current_team.countdown_time() / 1000; + str << (current_side != playing_side ? font::GRAY_TEXT : font::NULL_MARKUP); + if(sec < 60) str << "<200,0,0>"; else if(sec < 120)