CVSROOT:        /cvsroot/wesnoth
Module name:    wesnoth
Branch:         
Changes by:     Guillaume Melquiond <[EMAIL PROTECTED]> 05/04/27 19:34:09

Modified files:
        src            : actions.cpp 

Log message:
        Fix slow so that it removes an attack from the slowed unit, even if it 
is the last one. Don't remove it if it is the only one though. Also fix slow 
and berserk so that they play nice. And add a comment explaining why berserk 
and stoned already play nice.

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

Patches:
Index: wesnoth/src/actions.cpp
diff -u wesnoth/src/actions.cpp:1.211 wesnoth/src/actions.cpp:1.212
--- wesnoth/src/actions.cpp:1.211       Sun Apr 24 19:15:36 2005
+++ wesnoth/src/actions.cpp     Wed Apr 27 19:34:08 2005
@@ -1,4 +1,4 @@
-/* $Id: actions.cpp,v 1.211 2005/04/24 19:15:36 isaaccp Exp $ */
+/* $Id: actions.cpp,v 1.212 2005/04/27 19:34:08 silene Exp $ */
 /*
    Copyright (C) 2003 by David White <[EMAIL PROTECTED]>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -615,8 +615,8 @@
 
        statistics::attack_context attack_stats(a->second,d->second,stats);
 
-       const int orig_attacks = stats.nattacks;
-       const int orig_defends = stats.ndefends;
+       int orig_attacks = stats.nattacks;
+       int orig_defends = stats.ndefends;
        int to_the_death = stats.to_the_death ? 30 : 0;
 
        static const std::string poison_string("poison");
@@ -769,8 +769,10 @@
                                if(stats.attacker_slows && 
d->second.has_flag("slowed") == false) {
                                        
gui.float_label(d->first,_("slowed"),255,0,0);
                                        d->second.set_flag("slowed");
-                                       if(stats.ndefends > 1)
-                                               --stats.ndefends;
+                                       if (orig_defends > 1) {
+                                               if (stats.ndefends > 0) 
--stats.ndefends;
+                                               --orig_defends;
+                                       }
                                }
 
                                //if the defender is turned to stone, the fight 
stops immediately
@@ -932,8 +934,10 @@
                                if(stats.defender_slows && 
a->second.has_flag("slowed") == false) {
                                        
gui.float_label(a->first,_("slowed"),255,0,0);
                                        a->second.set_flag("slowed");
-                                       if(stats.nattacks > 1)
-                                               --stats.nattacks;
+                                       if (orig_attacks > 1) {
+                                               if (stats.nattacks > 0) 
--stats.nattacks;
+                                               --orig_attacks;
+                                       }
                                }
 
 
@@ -951,6 +955,8 @@
                        --stats.ndefends;
                }
 
+               // continue the fight to death; if one of the units got stoned,
+               // either nattacks or ndefends is -1
                if(to_the_death > 0 && stats.ndefends == 0 && stats.nattacks == 
0) {
                        stats.nattacks = orig_attacks;
                        stats.ndefends = orig_defends;


Reply via email to