Author: jamit
Date: Wed Oct 24 02:54:21 2012
New Revision: 55582
URL: http://svn.gna.org/viewcvs/wesnoth?rev=55582&view=rev
Log:
Sidebar enhancements to more clearly show active/inactive abilities and
specials.
Modified:
trunk/changelog
trunk/players_changelog
trunk/src/marked-up_text.cpp
trunk/src/marked-up_text.hpp
trunk/src/reports.cpp
trunk/src/unit_abilities.cpp
Modified: trunk/changelog
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/changelog?rev=55582&r1=55581&r2=55582&view=diff
==============================================================================
--- trunk/changelog (original)
+++ trunk/changelog Wed Oct 24 02:54:21 2012
@@ -47,6 +47,8 @@
* 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)
Modified: trunk/players_changelog
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/players_changelog?rev=55582&r1=55581&r2=55582&view=diff
==============================================================================
--- trunk/players_changelog (original)
+++ trunk/players_changelog Wed Oct 24 02:54:21 2012
@@ -45,6 +45,8 @@
* 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)
Modified: trunk/src/marked-up_text.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/marked-up_text.cpp?rev=55582&r1=55581&r2=55582&view=diff
==============================================================================
--- trunk/src/marked-up_text.cpp (original)
+++ trunk/src/marked-up_text.cpp Wed Oct 24 02:54:21 2012
@@ -54,6 +54,8 @@
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 };
Modified: trunk/src/marked-up_text.hpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/marked-up_text.hpp?rev=55582&r1=55581&r2=55582&view=diff
==============================================================================
--- trunk/src/marked-up_text.hpp (original)
+++ trunk/src/marked-up_text.hpp Wed Oct 24 02:54:21 2012
@@ -37,6 +37,8 @@
good_dmg_color,
bad_dmg_color,
weapon_details_color,
+ inactive_details_color,
+ inactive_ability_color,
unit_type_color,
race_color;
Modified: trunk/src/reports.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/reports.cpp?rev=55582&r1=55581&r2=55582&view=diff
==============================================================================
--- trunk/src/reports.cpp (original)
+++ trunk/src/reports.cpp Wed Oct 24 02:54:21 2012
@@ -365,10 +365,18 @@
{
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 @@
{
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 @@
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;
Modified: trunk/src/unit_abilities.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/unit_abilities.cpp?rev=55582&r1=55581&r2=55582&view=diff
==============================================================================
--- trunk/src/unit_abilities.cpp (original)
+++ trunk/src/unit_abilities.cpp Wed Oct 24 02:54:21 2012
@@ -732,6 +732,14 @@
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.
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits