[[Minor UI and gameplay fixes]]
* Add a Gold column to the status table (which accessible from the main menu). This field is blank for enemies. * Fixed the logic for determining who should and should not be included in the status table to work better with shared maps/vision. (this change only affects CVS)
This commit is contained in:
parent
61a8523e97
commit
eacd68f8c0
3 changed files with 31 additions and 18 deletions
|
@ -1567,9 +1567,9 @@ void turn_info::status_table()
|
|||
{
|
||||
std::vector<std::string> items;
|
||||
std::stringstream heading;
|
||||
heading << string_table["leader"] << ", ," << string_table["villages"] << ","
|
||||
<< string_table["units"] << "," << string_table["upkeep"] << ","
|
||||
<< string_table["income"];
|
||||
heading << string_table["leader"] << ", ," << string_table["gold"] << ","
|
||||
<< string_table["villages"] << "," << string_table["units"] << ","
|
||||
<< string_table["upkeep"] << "," << string_table["income"];
|
||||
|
||||
if(game_config::debug)
|
||||
heading << "," << string_table["gold"];
|
||||
|
@ -1581,11 +1581,14 @@ void turn_info::status_table()
|
|||
//if the player is under shroud or fog, they don't get to see
|
||||
//details about the other sides, only their own side, allied sides and a ??? is
|
||||
//shown to demonstrate lack of information about the other sides
|
||||
const bool fog = viewing_team.uses_fog() || viewing_team.uses_shroud();
|
||||
|
||||
bool fog = false;
|
||||
for(size_t n = 0; n != teams_.size(); ++n) {
|
||||
if(fog && viewing_team.is_enemy(n+1))
|
||||
const bool known = viewing_team.knows_about_team(n);
|
||||
const bool enemy = viewing_team.is_enemy(n+1);
|
||||
if(!known) {
|
||||
fog = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
const team_data data = calculate_team_data(teams_[n],n+1,units_);
|
||||
|
||||
|
@ -1598,6 +1601,11 @@ void turn_info::status_table()
|
|||
str << char(n+1) << "-," << char(n+1) << "-,";
|
||||
}
|
||||
|
||||
if(enemy) {
|
||||
str << " ,";
|
||||
} else {
|
||||
str << data.gold << ",";
|
||||
}
|
||||
//output the number of the side first, and this will
|
||||
//cause it to be displayed in the correct colour
|
||||
str << data.villages << ","
|
||||
|
|
19
src/team.cpp
19
src/team.cpp
|
@ -452,11 +452,6 @@ std::vector<team::target>& team::targets()
|
|||
return info_.targets;
|
||||
}
|
||||
|
||||
bool team::uses_shroud() const
|
||||
{
|
||||
return info_.use_shroud;
|
||||
}
|
||||
|
||||
bool team::shrouded(size_t x, size_t y) const
|
||||
{
|
||||
bool res = side_shrouded(x,y);
|
||||
|
@ -523,11 +518,6 @@ bool team::clear_shroud(size_t x, size_t y)
|
|||
}
|
||||
}
|
||||
|
||||
bool team::uses_fog() const
|
||||
{
|
||||
return info_.use_fog;
|
||||
}
|
||||
|
||||
bool team::side_fogged(size_t x, size_t y) const
|
||||
{
|
||||
if(info_.use_fog == false)
|
||||
|
@ -572,6 +562,15 @@ void team::refog()
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
bool team::knows_about_team(size_t index) const
|
||||
{
|
||||
if(this == &((*teams)[index])) return true;
|
||||
bool shroud = !uses_shroud() || (*teams)[index].uses_shroud() && (*teams)[index].share_maps();
|
||||
bool fog = !uses_fog() || (*teams)[index].uses_fog() && (*teams)[index].share_vision();
|
||||
return shroud && fog;
|
||||
}
|
||||
|
||||
const std::string& team::music() const
|
||||
{
|
||||
return info_.music;
|
||||
|
|
10
src/team.hpp
10
src/team.hpp
|
@ -118,11 +118,13 @@ public:
|
|||
bool shrouded(size_t x, size_t y) const;
|
||||
bool fogged(size_t x, size_t y) const;
|
||||
|
||||
bool uses_shroud() const;
|
||||
bool uses_shroud() const { return info_.use_shroud; }
|
||||
bool uses_fog() const { return info_.use_fog; }
|
||||
bool clear_shroud(size_t x, size_t y);
|
||||
bool uses_fog() const;
|
||||
bool clear_fog(size_t x, size_t y);
|
||||
void refog();
|
||||
|
||||
bool knows_about_team(size_t index) const;
|
||||
|
||||
bool auto_shroud_updates() const { return auto_shroud_updates_; }
|
||||
void set_auto_shroud_updates(bool value) { auto_shroud_updates_ = value; }
|
||||
|
@ -132,6 +134,10 @@ public:
|
|||
static int nteams();
|
||||
|
||||
private:
|
||||
//Make these public if you need them, but look at knows_about_team(...) first.
|
||||
bool share_maps() const { return info_.share_maps; }
|
||||
bool share_vision() const { return info_.share_vision; }
|
||||
|
||||
//Return true if the hex is shrouded/fogged for this side only
|
||||
//Ignores allied teams.
|
||||
bool side_shrouded(size_t x, size_t y) const;
|
||||
|
|
Loading…
Add table
Reference in a new issue