Sidebar enhancements to more clearly show active/inactive abilities...

...and specials.
This commit is contained in:
J. Tyne 2012-10-24 00:54:21 +00:00
parent 15e56212b6
commit 160d1e8bc1
6 changed files with 30 additions and 5 deletions

View File

@ -47,6 +47,8 @@ Version 1.11.0+svn:
* The sidebar now includes specials when reporting a weapon's damage.
* The sidebar now includes all specials when reporting a weapon's number of
attacks (not just swarm).
* Active/inactive highlighting for abilities and weapon specials in the
sidebar.
* Fix broken MP game creation dialog on low resolutions
* Whiteboard
* Don't end turn if executing all actions in another way than using the "end turn" button/hotkey. (bug #19901)

View File

@ -45,6 +45,8 @@ Version 1.11.0+svn:
* The sidebar now includes specials when reporting a weapon's damage.
* The sidebar now includes all specials when reporting a weapon's number of
attacks (not just swarm).
* Active/inactive highlighting for abilities and weapon specials in the
sidebar.
* Whiteboard
* Don't end turn if executing all actions in another way than using the "end turn" button/hotkey. (bug #19901)

View File

@ -54,6 +54,8 @@ const SDL_Color
good_dmg_color = { 130, 240, 50, 255 },
bad_dmg_color = { 250, 140, 80, 255 },
weapon_details_color = { 166, 146, 117, 255 },
inactive_details_color = { 146, 146, 146, 255 },
inactive_ability_color = { 146, 146, 146, 255 },
unit_type_color = { 245, 230, 193, 255 },
race_color = { 166, 146, 117, 255 };

View File

@ -37,6 +37,8 @@ extern const SDL_Color weapon_color,
good_dmg_color,
bad_dmg_color,
weapon_details_color,
inactive_details_color,
inactive_ability_color,
unit_type_color,
race_color;

View File

@ -365,10 +365,18 @@ static config unit_abilities(const unit* u)
{
std::ostringstream str, tooltip;
const std::string &name = abilities[i].get<0>().base_str();
str << abilities[i].get<1>().str();
if ( active[i] )
str << abilities[i].get<1>().str();
else
str << span_color(font::inactive_ability_color)
<< abilities[i].get<1>().str() << naps;
if ( i + 1 != abilities_size )
str << ", ";
tooltip << _("Ability: ") << abilities[i].get<2>().str();
tooltip << (active[i] ? _("Ability: ") : _("Ability (inactive): ") )
<< abilities[i].get<2>().str();
add_text(res, str.str(), tooltip.str(), "ability_" + name);
}
return res;
@ -561,7 +569,7 @@ static int attack_info(const attack_type &at, config &res, const unit &u, const
{
std::ostringstream str, tooltip;
at.set_specials_context(displayed_unit_hex);
at.set_specials_context(displayed_unit_hex, u.side() == resources::screen->playing_side());
int base_damage = at.damage();
int specials_damage = at.modified_damage(false);
int damage_multiplier = 100;
@ -714,11 +722,12 @@ static int attack_info(const attack_type &at, config &res, const unit &u, const
const size_t specials_size = specials.size();
for ( size_t i = 0; i != specials_size; ++i )
{
str << span_color(font::weapon_details_color)
str << span_color(active[i] ? font::weapon_details_color : font::inactive_details_color)
<< " " << specials[i].first << "</span>\n";
std::string help_page = "weaponspecial_" + specials[i].first.base_str();
//FIXME pull out special's name from description
tooltip << _("Weapon special: ") << specials[i].second << '\n';
tooltip << (active[i] ? _("Weapon special: ") : _("Weapon special (inactive): ") )
<< specials[i].second << '\n';
add_text(res, flush(str), flush(tooltip), help_page);
}
return damage;

View File

@ -732,6 +732,14 @@ namespace { // Helpers for attack_type::special_active()
const config & filter,
const std::string & child_tag)
{
if ( !loc.valid() )
// The special's context was set to ignore this unit, so assume we pass.
// (This is used by reports.cpp to show active specials when the
// opponent is not known. From a player's perspective, the special
// is active, in that it can be used, even though the player might
// need to select an appropriate opponent.)
return true;
const config & filter_child = filter.child(child_tag);
if ( !filter_child )
// The special does not filter on this unit, so we pass.