diff --git a/changelog b/changelog index 46850ddd751..799b590da92 100644 --- a/changelog +++ b/changelog @@ -46,6 +46,8 @@ Version 1.5.10+svn: * WML Engine: * Fixed bug #13024: Conditional [allow_undo] not always working right * Map size is now hard-limited to 200 by 200 + * attribute hidden in [side] allows to hide a side from status table, + it also can be changed by [modify_side] (FR #12814) Version 1.5.10: * Campaigns: diff --git a/data/core/about.cfg b/data/core/about.cfg index 97a5c721b32..18051f60a91 100644 --- a/data/core/about.cfg +++ b/data/core/about.cfg @@ -807,6 +807,9 @@ name = "Laurent Birtz" [/entry] [entry] ++ name = "Łukasz Dobrogowski (nital)" ++ [/entry] ++ [entry] name = "Manuel Osório Binelo (manuelb)" [/entry] [entry] diff --git a/src/game_events.cpp b/src/game_events.cpp index d03b746264c..3882480deb1 100644 --- a/src/game_events.cpp +++ b/src/game_events.cpp @@ -785,6 +785,7 @@ namespace { std::string recruit_str = cfg["recruit"]; std::string fog = cfg["fog"]; std::string shroud = cfg["shroud"]; + std::string hidden = cfg["hidden"]; std::string shroud_data = cfg["shroud_data"]; std::string village_gold = cfg["village_gold"]; const config& parsed = cfg.get_parsed_config(); @@ -836,6 +837,10 @@ namespace { if (!shroud_data.empty()) { (*teams)[team_index].merge_shroud_map_data(shroud_data); } + // Set whether team is hidden in status table + if (!hidden.empty()) { + (*teams)[team_index].set_hidden( utils::string_bool(hidden, true) ); + } // Set fog if (!fog.empty()) { (*teams)[team_index].set_fog( utils::string_bool(fog, true) ); diff --git a/src/menu_events.cpp b/src/menu_events.cpp index 75a2987a58d..c821c24043d 100644 --- a/src/menu_events.cpp +++ b/src/menu_events.cpp @@ -65,11 +65,6 @@ void remove_old_auto_saves() } } - - - - - } // end anonymous namespace namespace events{ @@ -390,6 +385,8 @@ private: const team& viewing_team = teams_[gui_->viewing_team()]; unsigned total_villages = 0; + // a variable to check if there are any teams to show in the table + bool status_table_empty = true; //if the player is under shroud or fog, they don't get //to see details about the other sides, only their own @@ -397,9 +394,10 @@ private: //lack of information about the other sides But he see //all names with in colours for(size_t n = 0; n != teams_.size(); ++n) { - if(teams_[n].is_empty()) { + if(teams_[n].is_empty()||teams_[n].hidden()) { continue; } + status_table_empty=false; const bool known = viewing_team.knows_about_team(n, network::nconnections() > 0); const bool enemy = viewing_team.is_enemy(n+1); @@ -421,7 +419,7 @@ private: leader_bools.push_back(true); leader_name = leader->second.name(); } else { - str << IMAGE_PREFIX << std::string("unknown-unit.png"); + str << IMAGE_PREFIX << std::string("units/unknown-unit.png"); leader_bools.push_back(false); leader_name = "Unknown"; } @@ -463,12 +461,22 @@ private: ERR_NG << "Logic error: map has " << map_.villages().size() << " villages but status table shows " << total_villages << " owned in total\n"; } + if (status_table_empty) + { + // no sides to show - display empty table + std::stringstream str; + str << " "; + for (int i=0;i<7;++i) + str << COLUMN_SEPARATOR << " "; + leader_bools.push_back(false); + items.push_back(str.str()); + } int result = 0; { leader_scroll_dialog slist(*gui_, _("Current Status"), leader_bools, selected, gui::DIALOG_FORWARD); slist.add_button(new gui::dialog_button(gui_->video(), _("More >"), - gui::button::TYPE_PRESS, gui::DIALOG_FORWARD), - gui::dialog::BUTTON_EXTRA_LEFT); + gui::button::TYPE_PRESS, gui::DIALOG_FORWARD), + gui::dialog::BUTTON_EXTRA_LEFT); slist.set_menu(items, &sorter); slist.get_menu().move_selection(selected); result = slist.show(); @@ -503,11 +511,13 @@ private: items.push_back(heading.str()); const team& viewing_team = teams_[gui_->viewing_team()]; + bool settings_table_empty = true; for(size_t n = 0; n != teams_.size(); ++n) { - if(teams_[n].is_empty()) { + if(teams_[n].is_empty()||teams_[n].hidden()) { continue; } + settings_table_empty = false; std::stringstream str; const unit_map::const_iterator leader = team_leader(n+1, units_); @@ -541,23 +551,32 @@ private: items.push_back(str.str()); } + + if (settings_table_empty) + { + // no sides to show - display empty table + std::stringstream str; + for (int i=0;i<8;++i) + str << " " << COLUMN_SEPARATOR; + leader_bools.push_back(false); + items.push_back(str.str()); + } + int result = 0; + { + leader_scroll_dialog slist(*gui_, _("Scenario Settings"), leader_bools, selected, gui::DIALOG_BACK); + slist.set_menu(items, &sorter); + slist.get_menu().move_selection(selected); + slist.add_button(new gui::dialog_button(gui_->video(), _(" < Back"), + gui::button::TYPE_PRESS, gui::DIALOG_BACK), + gui::dialog::BUTTON_EXTRA_LEFT); + result = slist.show(); + selected = slist.get_menu().selection(); + } // this will kill the dialog before scrolling - int result = 0; - { - leader_scroll_dialog slist(*gui_, _("Scenario Settings"), leader_bools, selected, gui::DIALOG_BACK); - slist.set_menu(items, &sorter); - slist.get_menu().move_selection(selected); - slist.add_button(new gui::dialog_button(gui_->video(), _(" < Back"), - gui::button::TYPE_PRESS, gui::DIALOG_BACK), - gui::dialog::BUTTON_EXTRA_LEFT); - result = slist.show(); - selected = slist.get_menu().selection(); - } // this will kill the dialog before scrolling - - if (result >= 0) - gui_->scroll_to_leader(units_, selected+1); - else if (result == gui::DIALOG_BACK) - status_table(selected); + if (result >= 0) + gui_->scroll_to_leader(units_, selected+1); + else if (result == gui::DIALOG_BACK) + status_table(selected); } void menu_handler::save_game(const std::string& message, gui::DIALOG_TYPE dialog_type, diff --git a/src/team.cpp b/src/team.cpp index 9968464afce..b50ce9e3534 100644 --- a/src/team.cpp +++ b/src/team.cpp @@ -111,6 +111,7 @@ team::team_info::team_info(const config& cfg) : disallow_observers(utils::string_bool(cfg["disallow_observers"])), allow_player(utils::string_bool(cfg["allow_player"], true)), no_leader(utils::string_bool(cfg["no_leader"])), + hidden(utils::string_bool(cfg["hidden"])), music(cfg["music"]), colour(cfg["colour"].size() ? cfg["colour"] : cfg["side"]) { @@ -344,6 +345,7 @@ void team::team_info::write(config& cfg) const cfg["disallow_observers"] = disallow_observers ? "yes" : "no"; cfg["allow_player"] = allow_player ? "yes" : "no"; cfg["no_leader"] = no_leader ? "yes" : "no"; + cfg["hidden"] = hidden ? "yes" : "no"; cfg["number_of_possible_recruits_to_force_recruit"] = lexical_cast(number_of_possible_recruits_to_force_recruit); std::stringstream enemies_str; diff --git a/src/team.hpp b/src/team.hpp index 2d00c112b57..7c4918a110a 100644 --- a/src/team.hpp +++ b/src/team.hpp @@ -118,6 +118,7 @@ public: bool disallow_observers; bool allow_player; bool no_leader; + bool hidden; std::string music; @@ -289,6 +290,8 @@ public: bool get_disallow_observers() {return info_.disallow_observers; }; std::string map_colour_to() const { return info_.colour; }; bool& no_leader() { return info_.no_leader; } + bool& hidden() { return info_.hidden; } + void set_hidden(bool value) { info_.hidden=value; } static int nteams();