mail[Wesnoth-commits] r40409 - /trunk/src/generate_report.cpp


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

Header


Content

Posted by guillaume . melquiond on December 26, 2009 - 11:31:
Author: silene
Date: Sat Dec 26 11:31:42 2009
New Revision: 40409

URL: http://svn.gna.org/viewcvs/wesnoth?rev=40409&view=rev
Log:
Prevented time of day from leaking on shrouded tiles. (Fix for bug #14996.)

Modified:
    trunk/src/generate_report.cpp

Modified: trunk/src/generate_report.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/generate_report.cpp?rev=40409&r1=40408&r2=40409&view=diff
==============================================================================
--- trunk/src/generate_report.cpp (original)
+++ trunk/src/generate_report.cpp Sat Dec 26 11:31:42 2009
@@ -367,20 +367,24 @@
        case UNIT_PROFILE:
                return report("", u->profile(), "");
        case TIME_OF_DAY: {
-               time_of_day tod = 
resources::tod_manager->time_of_day_at(units, mouseover, 
*resources::game_map);
-
-               // Don't show illuminated time on fogged/shrouded tiles
-               if (current_team.fogged(mouseover) || 
current_team.shrouded(mouseover)) {
-                       tod = resources::tod_manager->get_time_of_day(false, 
mouseover);
-               }
-               std::stringstream tooltip;
-
-               tooltip << tod.name << "\n"
-                               << _("Lawful units: ")
-                               << (tod.lawful_bonus > 0 ? "+" : "") << 
tod.lawful_bonus << "%\n"
-                               << _("Neutral units: ") << "0%\n"
-                               << _("Chaotic units: ")
-                               << (tod.lawful_bonus < 0 ? "+" : "") << 
(tod.lawful_bonus*-1) << "%";
+               time_of_day tod;
+
+               if (current_team.shrouded(mouseover)) {
+                       // Don't show time on shrouded tiles.
+                       tod = resources::tod_manager->get_time_of_day();
+               } else if (current_team.fogged(mouseover)) {
+                       // Don't show illuminated time on fogged tiles.
+                       tod = resources::tod_manager->get_time_of_day(0, 
mouseover);
+               } else {
+                       tod = resources::tod_manager->time_of_day_at(units, 
mouseover, *resources::game_map);
+               }
+
+               std::ostringstream tooltip;
+               int b = tod.lawful_bonus;
+               tooltip << tod.name << '\n'
+                       << _("Lawful units: ") << (b > 0 ? "+" : "") << b << 
"%\n"
+                       << _("Neutral units: ") << "0%\n"
+                       << _("Chaotic units: ") << (b < 0 ? "+" : "") << -b 
<< "%";
 
                std::string tod_image = tod.image;
                if (tod.bonus_modified > 0) tod_image += "~BRIGHTEN()";




Related Messages


Powered by MHonArc, Updated Sat Dec 26 13:20:06 2009