Author: cjhopman
Date: Thu Apr 23 22:06:45 2009
New Revision: 35139
URL: http://svn.gna.org/viewcvs/wesnoth?rev=35139&view=rev
Log:
-remove sqrt() from a* search heuristic, now uses just the squared value as it
is significantly faster
Modified:
trunk/src/astarnode.hpp
Modified: trunk/src/astarnode.hpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/astarnode.hpp?rev=35139&r1=35138&r2=35139&view=diff
==============================================================================
--- trunk/src/astarnode.hpp (original)
+++ trunk/src/astarnode.hpp Thu Apr 23 22:06:45 2009
@@ -53,10 +53,10 @@
double ydiff = (src.y - dst.y) + ((src.x & 1) - (dst.x & 1)) *
0.5;
// we assume a map with a maximum diagonal of 300 (bigger than
a 200x200)
- // and we divide by 300 * 10000 to avoid interfering with the
defense subcost
+ // and we divide by 90000 * 10000 to avoid interfering with the
defense subcost
// (see shortest_path_calculator::cost)
return distance_between(src, dst) -
- (300.0 - sqrt( xdiff*xdiff + ydiff*ydiff)) /
3000000.0;
+ (90000.0 - ( xdiff*xdiff + ydiff*ydiff)) /
900000000.0;
// TODO: move the heuristic function into the cost_calculator
// so we can use case-specific heuristic
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits