Author: alink
Date: Sun May 10 02:42:54 2009
New Revision: 35521
URL: http://svn.gna.org/viewcvs/wesnoth?rev=35521&view=rev
Log:
Optimization of A*:
Skip cost function when its smallest possible value(1) is already too much
Modified:
trunk/src/astarsearch.cpp
Modified: trunk/src/astarsearch.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/astarsearch.cpp?rev=35521&r1=35520&r2=35521&view=diff
==============================================================================
--- trunk/src/astarsearch.cpp (original)
+++ trunk/src/astarsearch.cpp Sun May 10 02:42:54 2009
@@ -164,7 +164,8 @@
node& next = nodes[index(locs[i])];
double thresh = (next.in - search_counter <= 1u) ?
next.g : stop_at;
- if (n.g >= thresh) continue;
+ // cost() is always >= 1 (assumed and needed by the
heuristic)
+ if (n.g + 1 >= thresh) continue;
double cost = n.g + calc->cost(n.curr, locs[i], n.g);
if (cost >= thresh) continue;
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits