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

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

[Wesnoth-cvs-commits] wesnoth/src ai_move.cpp


From: David White
Subject: [Wesnoth-cvs-commits] wesnoth/src ai_move.cpp
Date: Fri, 12 Nov 2004 22:15:09 -0500

CVSROOT:        /cvsroot/wesnoth
Module name:    wesnoth
Branch:         
Changes by:     David White <address@hidden>    04/11/13 03:09:14

Modified files:
        src            : ai_move.cpp 

Log message:
        fixed potential divide-by-0 error

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

Patches:
Index: wesnoth/src/ai_move.cpp
diff -u wesnoth/src/ai_move.cpp:1.49 wesnoth/src/ai_move.cpp:1.50
--- wesnoth/src/ai_move.cpp:1.49        Mon Sep 27 22:56:49 2004
+++ wesnoth/src/ai_move.cpp     Sat Nov 13 03:09:14 2004
@@ -1,4 +1,4 @@
-/* $Id: ai_move.cpp,v 1.49 2004/09/27 22:56:49 Sirp Exp $ */
+/* $Id: ai_move.cpp,v 1.50 2004/11/13 03:09:14 Sirp Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -491,7 +491,7 @@
                        const move_cost_calculator 
calc(u->second,map_,gameinfo_,units_,u->first,dstsrc,enemy_dstsrc);
                        const paths::route cur_route = 
a_star_search(u->first,best_target->loc,
                                               
minimum(best_target->value/best_rating,100.0),calc);
-                       double rating = best_target->value/cur_route.move_left;
+                       double rating = 
best_target->value/maximum<int>(1,cur_route.move_left);
 
                        //for 'support' targets, they are rated much higher if 
we can get there within two turns,
                        //otherwise they are worthless to go for at all.




reply via email to

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