wesnoth-cvs-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Wesnoth-cvs-commits] wesnoth/src playturn.cpp


From: Guillaume Melquiond
Subject: [Wesnoth-cvs-commits] wesnoth/src playturn.cpp
Date: Tue, 28 Sep 2004 15:32:44 -0400

CVSROOT:        /cvsroot/wesnoth
Module name:    wesnoth
Branch:         
Changes by:     Guillaume Melquiond <address@hidden>    04/09/28 19:26:01

Modified files:
        src            : playturn.cpp 

Log message:
        Quick and dirty hack so that people can escape from the "statistics 
dialog seemingly endless loop" nightmare. The dialog really needs to be redone 
so that it becomes user-friendly.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/playturn.cpp.diff?tr1=1.273&tr2=1.274&r1=text&r2=text

Patches:
Index: wesnoth/src/playturn.cpp
diff -u wesnoth/src/playturn.cpp:1.273 wesnoth/src/playturn.cpp:1.274
--- wesnoth/src/playturn.cpp:1.273      Mon Sep 27 00:24:41 2004
+++ wesnoth/src/playturn.cpp    Tue Sep 28 19:26:01 2004
@@ -1,4 +1,4 @@
-/* $Id: playturn.cpp,v 1.273 2004/09/27 00:24:41 ydirson Exp $ */
+/* $Id: playturn.cpp,v 1.274 2004/09/28 19:26:01 silene Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -2033,7 +2033,7 @@
 {
        const statistics::stats& stats = 
statistics::calculate_stats(0,gui_.viewing_team()+1);
        std::vector<std::string> items;
-       
+
        {
                std::stringstream str;
                str << _("Recruits") << "," << 
statistics::sum_str_int_map(stats.recruits);
@@ -2090,37 +2090,38 @@
                items.push_back(str.str());
        }
 
-       const int res = 
gui::show_dialog(gui_,NULL,_("Statistics"),"",gui::CLOSE_ONLY,&items);
-       std::string title;
-       items.clear();
-       switch(res) {
-       case 0:
-               items = create_unit_table(stats.recruits);
-               title = _("Recruits");
-               break;
-       case 1:
-               items = create_unit_table(stats.recalls);
-               title = _("Recalls");
-               break;
-       case 2:
-               items = create_unit_table(stats.advanced_to);
-               title = _("Advancements");
-               break;
-       case 3:
-               items = create_unit_table(stats.deaths);
-               title = _("Losses");
-               break;
-       case 4:
-               items = create_unit_table(stats.killed);
-               title = _("Kills");
-               break;
-       default:
-               return;
-       }
+       for(;;) {
+               const int res = gui::show_dialog(gui_, NULL, _("Statistics"), 
"", gui::OK_CANCEL, &items);
+               std::string title;
+               std::vector<std::string> items_sub;
+
+               switch(res) {
+               case 0:
+                       items_sub = create_unit_table(stats.recruits);
+                       title = _("Recruits");
+                       break;
+               case 1:
+                       items_sub = create_unit_table(stats.recalls);
+                       title = _("Recalls");
+                       break;
+               case 2:
+                       items_sub = create_unit_table(stats.advanced_to);
+                       title = _("Advancements");
+                       break;
+               case 3:
+                       items_sub = create_unit_table(stats.deaths);
+                       title = _("Losses");
+                       break;
+               case 4:
+                       items_sub = create_unit_table(stats.killed);
+                       title = _("Kills");
+                       break;
+               default:
+                       return;
+               }
 
-       if(items.empty() == false) {
-               gui::show_dialog(gui_,NULL,"",title,gui::OK_ONLY,&items);
-               show_statistics();
+               if (items_sub.empty() == false)
+                       gui::show_dialog(gui_, NULL, "", title, gui::OK_ONLY, 
&items_sub);
        }
 }
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]