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


From: ott
Subject: [Wesnoth-cvs-commits] wesnoth/src actions.cpp
Date: Fri, 13 May 2005 11:57:47 -0400

CVSROOT:        /cvsroot/wesnoth
Module name:    wesnoth
Branch:         
Changes by:     ott <address@hidden>    05/05/13 15:57:46

Modified files:
        src            : actions.cpp 

Log message:
        fix no counterattack and move-and-attack breaking %-to-kill (cvs 
internal)

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

Patches:
Index: wesnoth/src/actions.cpp
diff -u wesnoth/src/actions.cpp:1.217 wesnoth/src/actions.cpp:1.218
--- wesnoth/src/actions.cpp:1.217       Fri May 13 14:00:47 2005
+++ wesnoth/src/actions.cpp     Fri May 13 15:57:46 2005
@@ -1,4 +1,4 @@
-/* $Id: actions.cpp,v 1.217 2005/05/13 14:00:47 darthfool Exp $ */
+/* $Id: actions.cpp,v 1.218 2005/05/13 15:57:46 ott Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -238,7 +238,13 @@
 {
        // calculate Pr[A does damage in [m,...)], where
        // p probability to hit, n swings, d damage/swing
-       double P = 0;
+       double P = 0.0;
+       // 0 damage can happen when unit has no attack of this type
+       if(d == 0) {
+               if(m <= 0)
+                       P = 1.0;
+               return P;
+       }
        for(int k = (m + d - 1)/d; k <= n; ++k) {
                double r = 1.0;
                const int k2 = (k > n - k) ? (n - k) : k;




reply via email to

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