mail[Wesnoth-commits] r27432 - /trunk/data/ais/bruteforce.py


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

Header


Content

Posted by greg on June 23, 2008 - 14:54:
Author: oracle
Date: Mon Jun 23 14:54:08 2008
New Revision: 27432

URL: http://svn.gna.org/viewcvs/wesnoth?rev=27432&view=rev
Log:
Fixed a ZeroDivisionError bug which is triggered on certain maps.


Modified:
    trunk/data/ais/bruteforce.py

Modified: trunk/data/ais/bruteforce.py
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/data/ais/bruteforce.py?rev=27432&r1=27431&r2=27432&view=diff
==============================================================================
--- trunk/data/ais/bruteforce.py (original)
+++ trunk/data/ais/bruteforce.py Mon Jun 23 14:54:08 2008
@@ -302,7 +302,12 @@
             for y in range(m.y):
                 loc = wesnoth.get_location(x,y)
                 speed += 1.0 / recruit.movement_cost(loc)
-                defense += 100.0 / recruit.defense_modifier(loc) - 1
+                rdm = recruit.defense_modifier(loc)
+                if rdm:
+                    defense += 100.0 / rdm - 1
+
+                else:
+                    defense += 1.00
 
         # speed is more important on larger maps
         speed *= self.mapsize * recruit.movement / n




Related Messages


Powered by MHonArc, Updated Mon Jun 23 15:02:14 2008