mail[Wesnoth-commits] r36895 - in /trunk: changelog data/core/about.cfg src/statistics.cpp src/statistics.hpp src/statistics_dialog.cpp


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

Header


Content

Posted by guillaume . melquiond on July 14, 2009 - 19:35:
Author: silene
Date: Tue Jul 14 19:35:32 2009
New Revision: 36895

URL: http://svn.gna.org/viewcvs/wesnoth?rev=36895&view=rev
Log:
Added cost of units recruited, recalled, killed, and lost, to the statistics 
window (patch #1190 by lizard).

Modified:
    trunk/changelog
    trunk/data/core/about.cfg
    trunk/src/statistics.cpp
    trunk/src/statistics.hpp
    trunk/src/statistics_dialog.cpp

Modified: trunk/changelog
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/changelog?rev=36895&r1=36894&r2=36895&view=diff
==============================================================================
--- trunk/changelog (original)
+++ trunk/changelog Tue Jul 14 19:35:32 2009
@@ -18,6 +18,7 @@
    * Added support for desktop notifications using KDE's
      org.kde.VisualNotifications DBus service
    * Changed "Toggle Full Screen" button to say "Full Screen" (bug #13909)
+   * Added cost of units recruited, recalled, killed, and lost, to the 
statistics window (patch #1190)
  * Miscellaneous and bugfixes:
    * Fixed language switch not affecting unit descriptions (bug #13827)
    * Fixed teleporting to impassable terrain (bug #13795)

Modified: trunk/data/core/about.cfg
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/data/core/about.cfg?rev=36895&r1=36894&r2=36895&view=diff
==============================================================================
--- trunk/data/core/about.cfg (original)
+++ trunk/data/core/about.cfg Tue Jul 14 19:35:32 2009
@@ -912,6 +912,9 @@
         name = "Rocco J Carello (rogue)"
     [/entry]
     [entry]
+        name = "Rolf Sievers (Lizard)"
+    [/entry]
+    [entry]
         name = "Ronny Standtke"
     [/entry]
     [entry]

Modified: trunk/src/statistics.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/statistics.cpp?rev=36895&r1=36894&r2=36895&view=diff
==============================================================================
--- trunk/src/statistics.cpp (original)
+++ trunk/src/statistics.cpp Tue Jul 14 19:35:32 2009
@@ -669,5 +669,15 @@
        return res;
 }
 
+int sum_cost_str_int_map(const stats::str_int_map &m)
+{
+       int cost = 0;
+       for (stats::str_int_map::const_iterator i = m.begin(); i != m.end(); 
++i) {
+               cost += i->second * 
unit_type_data::types().find_unit_type(i->first)->second.cost();
+       }
+
+       return cost;
+}
+
 } // end namespace statistics
 

Modified: trunk/src/statistics.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/statistics.hpp?rev=36895&r1=36894&r2=36895&view=diff
==============================================================================
--- trunk/src/statistics.hpp (original)
+++ trunk/src/statistics.hpp Tue Jul 14 19:35:32 2009
@@ -66,6 +66,7 @@
        };
 
        int sum_str_int_map(const stats::str_int_map& m);
+       int sum_cost_str_int_map(const stats::str_int_map &m);
 
        struct disabler
        {

Modified: trunk/src/statistics_dialog.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/statistics_dialog.cpp?rev=36895&r1=36894&r2=36895&view=diff
==============================================================================
--- trunk/src/statistics_dialog.cpp (original)
+++ trunk/src/statistics_dialog.cpp Tue Jul 14 19:35:32 2009
@@ -115,48 +115,64 @@
                                gui::dialog::BUTTON_STANDARD);
 
        stats_ = statistics::calculate_stats(0, team_id);
-       int n;
+       int n, cost;
        std::vector<std::string> items;
        // Prepare the menu items
        {
                std::stringstream str;
                n = statistics::sum_str_int_map(stats_.recruits);
+               cost = stats_.recruit_cost;
                unit_count_[0] = n;
-               str << _("Recruits") << COLUMN_SEPARATOR << n;
+               str << _("Recruits") << COLUMN_SEPARATOR << n
+                   << COLUMN_SEPARATOR
+                   << COLUMN_SEPARATOR << IMAGE_PREFIX << "themes/gold-t.png"
+                   << COLUMN_SEPARATOR << cost;
                items.push_back(str.str());
        }
        {
                std::stringstream str;
                n = statistics::sum_str_int_map(stats_.recalls);
+               cost = stats_.recall_cost;
                unit_count_[1] = n;
-               str << _("Recalls") << COLUMN_SEPARATOR << n;
+               str << _("Recalls") << COLUMN_SEPARATOR << n
+                   << COLUMN_SEPARATOR
+                   << COLUMN_SEPARATOR << IMAGE_PREFIX << "themes/gold-t.png"
+                   << COLUMN_SEPARATOR << cost;
                items.push_back(str.str());
        }
        {
                std::stringstream str;
                n = statistics::sum_str_int_map(stats_.advanced_to);
                unit_count_[2] = n;
-        str << _("Advancements") << COLUMN_SEPARATOR << n;
+               str << _("Advancements") << COLUMN_SEPARATOR << n;
                items.push_back(str.str());
        }
        {
                std::stringstream str;
                n = statistics::sum_str_int_map(stats_.deaths);
                unit_count_[3] = n;
-               str << _("Losses") << COLUMN_SEPARATOR << n;
+               cost = statistics::sum_cost_str_int_map(stats_.deaths);
+               str << _("Losses") << COLUMN_SEPARATOR << n
+                   << COLUMN_SEPARATOR
+                   << COLUMN_SEPARATOR << IMAGE_PREFIX << "themes/gold-t.png"
+                   << COLUMN_SEPARATOR << cost;
                items.push_back(str.str());
        }
        {
                std::stringstream str;
                n = statistics::sum_str_int_map(stats_.killed);
                unit_count_[4] = n;
-               str << _("Kills") << COLUMN_SEPARATOR << n;
+               cost = statistics::sum_cost_str_int_map(stats_.killed);
+               str << _("Kills") << COLUMN_SEPARATOR << n
+                   << COLUMN_SEPARATOR
+                   << COLUMN_SEPARATOR << IMAGE_PREFIX << "themes/gold-t.png"
+                   << COLUMN_SEPARATOR << cost;
                items.push_back(str.str());
        }
        items.push_back("");
        {
                std::stringstream str;
-        str << font::BOLD_TEXT << _("Damage")
+               str << font::BOLD_TEXT << _("Damage")
                    << COLUMN_SEPARATOR << _("Over All") << COLUMN_SEPARATOR
                    << COLUMN_SEPARATOR
                    << COLUMN_SEPARATOR << _("This Turn");




Related Messages


Powered by MHonArc, Updated Tue Jul 14 19:40:43 2009