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

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

[Wesnoth-cvs-commits] wesnoth/src actions.cpp dialogs.cpp help.cpp pl...


From: Guillaume Melquiond
Subject: [Wesnoth-cvs-commits] wesnoth/src actions.cpp dialogs.cpp help.cpp pl...
Date: Sat, 19 Mar 2005 09:54:01 -0500

CVSROOT:        /cvsroot/wesnoth
Module name:    wesnoth
Branch:         
Changes by:     Guillaume Melquiond <address@hidden>    05/03/19 14:54:01

Modified files:
        src            : actions.cpp dialogs.cpp help.cpp playturn.cpp 

Log message:
        Fix breakage of village capture and help system. Also symplify some 
conditionals since size_t is stated to be an unsigned type that can at least 
contain a normal-sized positive integer.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/actions.cpp.diff?tr1=1.197&tr2=1.198&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/dialogs.cpp.diff?tr1=1.91&tr2=1.92&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/help.cpp.diff?tr1=1.79&tr2=1.80&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/playturn.cpp.diff?tr1=1.345&tr2=1.346&r1=text&r2=text

Patches:
Index: wesnoth/src/actions.cpp
diff -u wesnoth/src/actions.cpp:1.197 wesnoth/src/actions.cpp:1.198
--- wesnoth/src/actions.cpp:1.197       Sat Mar 19 13:02:34 2005
+++ wesnoth/src/actions.cpp     Sat Mar 19 14:54:00 2005
@@ -1,4 +1,4 @@
-/* $Id: actions.cpp,v 1.197 2005/03/19 13:02:34 gruikya Exp $ */
+/* $Id: actions.cpp,v 1.198 2005/03/19 14:54:00 silene Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -1677,7 +1677,7 @@
        if(map.is_village(steps.back())) {
                orig_village_owner = village_owner(steps.back(),teams);
 
-               if(orig_village_owner >= 0 && size_t(orig_village_owner) != 
team_num) {
+               if (size_t(orig_village_owner) != team_num) {
                        ui->second.set_movement(0);
                        get_village(steps.back(),teams,team_num,units);
                }
Index: wesnoth/src/dialogs.cpp
diff -u wesnoth/src/dialogs.cpp:1.91 wesnoth/src/dialogs.cpp:1.92
--- wesnoth/src/dialogs.cpp:1.91        Sat Mar 19 13:02:34 2005
+++ wesnoth/src/dialogs.cpp     Sat Mar 19 14:54:00 2005
@@ -1,4 +1,4 @@
-/* $Id: dialogs.cpp,v 1.91 2005/03/19 13:02:34 gruikya Exp $ */
+/* $Id: dialogs.cpp,v 1.92 2005/03/19 14:54:00 silene Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -275,7 +275,7 @@
 
 void save_preview_pane::draw_contents()
 {
-       if(index_ < 0 || size_t(index_) >= summaries_->size() || info_->size() 
!= summaries_->size()) {
+       if (size_t(index_) >= summaries_->size() || info_->size() != 
summaries_->size()) {
                return;
        }
 
@@ -757,7 +757,7 @@
 
 void campaign_preview_pane::draw_contents()
 {
-       if(index_ < 0 || size_t(index_) >= descriptions_->size()) {
+       if (size_t(index_) >= descriptions_->size()) {
                return;
        }
 
Index: wesnoth/src/help.cpp
diff -u wesnoth/src/help.cpp:1.79 wesnoth/src/help.cpp:1.80
--- wesnoth/src/help.cpp:1.79   Sat Mar 19 13:02:34 2005
+++ wesnoth/src/help.cpp        Sat Mar 19 14:54:00 2005
@@ -2587,11 +2587,8 @@
        gui::draw_dialog(xloc, yloc, width, height, disp.video(), _("The Battle 
for Wesnoth Help"),
                                         NULL, &buttons_ptr, &restorer);
 
-       if ( (last_num_encountered_units >= 0 && 
-                        preferences::encountered_units().size() != 
size_t(last_num_encountered_units)) ||
-                       (last_num_encountered_terrains >= 0 &&
-                        preferences::encountered_terrains().size() != 
size_t(last_num_encountered_terrains))) {
-
+       if (preferences::encountered_units().size() != 
size_t(last_num_encountered_units) ||
+           preferences::encountered_terrains().size() != 
size_t(last_num_encountered_terrains)) {
                // More units or terrains encountered, update the contents.
                last_num_encountered_units = 
preferences::encountered_units().size();
                last_num_encountered_terrains = 
preferences::encountered_terrains().size();
Index: wesnoth/src/playturn.cpp
diff -u wesnoth/src/playturn.cpp:1.345 wesnoth/src/playturn.cpp:1.346
--- wesnoth/src/playturn.cpp:1.345      Sat Mar 19 13:02:34 2005
+++ wesnoth/src/playturn.cpp    Sat Mar 19 14:54:00 2005
@@ -1,4 +1,4 @@
-/* $Id: playturn.cpp,v 1.345 2005/03/19 13:02:34 gruikya Exp $ */
+/* $Id: playturn.cpp,v 1.346 2005/03/19 14:54:00 silene Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -1176,7 +1176,7 @@
        static const std::string style = "menu2";
        const int res = gui::show_dialog(gui_,NULL,"","",
                        
gui::MESSAGE,&menu,NULL,"",NULL,-1,NULL,NULL,xloc,yloc,&style);
-       if(res < 0 || size_t(res) >= items.size())
+       if (size_t(res) >= items.size())
                return;
 
        const hotkey::HOTKEY_COMMAND cmd = 
hotkey::get_hotkey(items[res]).get_id();
@@ -2070,7 +2070,7 @@
                                          
gui::OK_CANCEL,&options,&preview_panes);
        }
 
-       if(choice >= 0 && size_t(choice) < unit_choices.size()) {
+       if (size_t(choice) < unit_choices.size()) {
                units_.erase(last_hex_);
                
units_.insert(std::pair<gamemap::location,unit>(last_hex_,unit_choices[choice]));
                gui_.invalidate(last_hex_);




reply via email to

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