[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Wesnoth-cvs-commits] wesnoth/src ai.cpp
From: |
Jon Daniel |
Subject: |
[Wesnoth-cvs-commits] wesnoth/src ai.cpp |
Date: |
Sat, 22 Jan 2005 11:43:10 -0500 |
CVSROOT: /cvsroot/wesnoth
Module name: wesnoth
Branch:
Changes by: Jon Daniel <address@hidden> 05/01/22 16:43:10
Modified files:
src : ai.cpp
Log message:
Return sum instead of zero in case a division by zero would appears.
There are cases where sum isn't 0 if weight_sum is.
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/ai.cpp.diff?tr1=1.133&tr2=1.134&r1=text&r2=text
Patches:
Index: wesnoth/src/ai.cpp
diff -u wesnoth/src/ai.cpp:1.133 wesnoth/src/ai.cpp:1.134
--- wesnoth/src/ai.cpp:1.133 Sat Jan 22 06:27:17 2005
+++ wesnoth/src/ai.cpp Sat Jan 22 16:43:09 2005
@@ -1,4 +1,4 @@
-/* $Id: ai.cpp,v 1.133 2005/01/22 06:27:17 j_daniel Exp $ */
+/* $Id: ai.cpp,v 1.134 2005/01/22 16:43:09 j_daniel Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -1376,7 +1376,7 @@
// if it has no attack at all the ai shouldn't prefer
// that unit anyway
if (weight_sum == 0) {
- return 0;
+ return sum;
}
return sum/weight_sum;
}