mail[Wesnoth-commits] r44540 - in /trunk: changelog players_changelog src/game_display.cpp


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by gabrielmorin on July 22, 2010 - 10:43:
Author: gabba
Date: Thu Jul 22 10:43:19 2010
New Revision: 44540

URL: http://svn.gna.org/viewcvs/wesnoth?rev=44540&view=rev
Log:
Little bonus feature to check out terrain defense for the units you select 
when it's not your turn.
Feedback needed, if people like it I'll do a bit of code cleanup, otherwise 
this revision will be easy to revert.
This feature will be useful for the whiteboard's out-of-turn planning, but I 
can always re-implement it specifically for the whiteboard move arrows.
Note: the feature doesn't work while enemy units (at least AI units) are 
moving/attacking.

Modified:
    trunk/changelog
    trunk/players_changelog
    trunk/src/game_display.cpp

Modified: trunk/changelog
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/changelog?rev=44540&r1=44539&r2=44540&view=diff
==============================================================================
--- trunk/changelog (original)
+++ trunk/changelog Thu Jul 22 10:43:19 2010
@@ -188,6 +188,7 @@
      to override them without first removing them
    * [effect] violate_maximum= (for use when increasing HP) takes a real 
boolean
      value now instead of taking any non-empty value as "true".
+   * Allow checking out terrain defense for units when it's not your turn.
  * Miscellaneous and bug fixes:
    * Added help entry when new unit is created directly in the recall list
    * Defaulted log level to warning again

Modified: trunk/players_changelog
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/players_changelog?rev=44540&r1=44539&r2=44540&view=diff
==============================================================================
--- trunk/players_changelog (original)
+++ trunk/players_changelog Thu Jul 22 10:43:19 2010
@@ -69,6 +69,7 @@
    * Display weapon stats in recruit/recall dialog the same way as in 
sidebar.
    * Remember recall list sorting order.
    * New mouseover image instead of simply highlighting the hex
+   * Allow checking out terrain defense for units when it's not your turn.
 
  * Miscellaneous and bug fixes:
    * All villages except water and swamp villages can now be placed on any 
base

Modified: trunk/src/game_display.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/game_display.cpp?rev=44540&r1=44539&r2=44540&view=diff
==============================================================================
--- trunk/src/game_display.cpp (original)
+++ trunk/src/game_display.cpp Thu Jul 22 10:43:19 2010
@@ -626,6 +626,24 @@
 
                        // The hex is full now, so skip the "show enemy moves"
                        return;
+               }
+       }
+       // When out-of-turn, it's still interesting to check out the terrain 
defs of the selected unit
+       else if (selectedHex_.valid() && loc == mouseoverHex_)
+       {
+               const unit_map::const_iterator selectedUnit = 
units_.find(selectedHex_);
+               const unit_map::const_iterator mouseoveredUnit = 
units_.find(mouseoverHex_);
+               if(selectedUnit != units_.end() && mouseoveredUnit == 
units_.end()) {
+                       // Display the def% of this terrain
+                       int def =  100 - 
selectedUnit->defense_modifier(get_map().get_terrain(loc));
+                       std::stringstream def_text;
+                       def_text << def << "%";
+
+                       SDL_Color color = 
int_to_color(game_config::red_to_green(def, false));
+
+                       // use small font
+                       int def_font = 16;
+                       draw_text_in_hex(loc, LAYER_MOVE_INFO, 
def_text.str(), def_font, color);
                }
        }
 




Related Messages


Powered by MHonArc, Updated Thu Jul 22 11:20:16 2010