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: Mon, 27 Sep 2004 19:07:19 -0400

CVSROOT:        /cvsroot/wesnoth
Module name:    wesnoth
Branch:         
Changes by:     David White <address@hidden>    04/09/27 22:56:50

Modified files:
        src            : ai_move.cpp 

Log message:
        fixed divide-by-0 error in AI

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

Patches:
Index: wesnoth/src/ai_move.cpp
diff -u wesnoth/src/ai_move.cpp:1.48 wesnoth/src/ai_move.cpp:1.49
--- wesnoth/src/ai_move.cpp:1.48        Sun Sep 19 11:30:23 2004
+++ wesnoth/src/ai_move.cpp     Mon Sep 27 22:56:49 2004
@@ -1,4 +1,4 @@
-/* $Id: ai_move.cpp,v 1.48 2004/09/19 11:30:23 silene Exp $ */
+/* $Id: ai_move.cpp,v 1.49 2004/09/27 22:56:49 Sirp Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -424,7 +424,7 @@
                const paths::route cur_route = a_star_search(u->first,tg->loc,
                                       
minimum(tg->value/best_rating,500.0),cost_calc);
 
-               double rating = tg->value/cur_route.move_left;
+               double rating = tg->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]