diff options
author | Adam Borowski <kilobyte@angband.pl> | 2012-08-31 00:44:20 +0200 |
---|---|---|
committer | Adam Borowski <kilobyte@angband.pl> | 2012-08-31 00:44:20 +0200 |
commit | a9eeb4a370e85069c25286e5cedc9682d5d04b2e (patch) | |
tree | 450c0ccd5f5353553d5b96edee2850623dffcc03 /crawl-ref/source/mon-pathfind.cc | |
parent | 57aec7d2a0ae1095fb1babd8f0fcc276927bf8e5 (diff) | |
parent | 35613e094ca5d0be028ee9261afebf3e35faa563 (diff) | |
download | crawl-ref-a9eeb4a370e85069c25286e5cedc9682d5d04b2e.tar.gz crawl-ref-a9eeb4a370e85069c25286e5cedc9682d5d04b2e.zip |
Merge branch 'master' into glasnost
Yay for conflicts galore (wax removal, std:: purge, tileidx changes).
Diffstat (limited to 'crawl-ref/source/mon-pathfind.cc')
-rw-r--r-- | crawl-ref/source/mon-pathfind.cc | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/crawl-ref/source/mon-pathfind.cc b/crawl-ref/source/mon-pathfind.cc index 31ac4bfacf..658d03d84e 100644 --- a/crawl-ref/source/mon-pathfind.cc +++ b/crawl-ref/source/mon-pathfind.cc @@ -233,7 +233,7 @@ bool monster_pathfind::calc_path_to_neighbours() continue; #ifdef DEBUG_PATHFIND - mprf("old dist: %d, new dist: %d, infinite: %d", old_dist, distance, + mprf("old dist: %d, new dist: %d, infinite: %d", old_dist, distance2, INFINITE_DISTANCE); #endif // If the new distance is better than the old one (initialised with @@ -298,7 +298,7 @@ bool monster_pathfind::get_best_position() if (i > min_length) min_length = i; - std::vector<coord_def> &vec = hash[i]; + vector<coord_def> &vec = hash[i]; // Pick the last position pushed into the vector as it's most // likely to be close to the target. pos = vec[vec.size()-1]; @@ -322,12 +322,12 @@ bool monster_pathfind::get_best_position() // Using the prev vector backtrack from start to target to find all steps to // take along the shortest path. -std::vector<coord_def> monster_pathfind::backtrack() +vector<coord_def> monster_pathfind::backtrack() { #ifdef DEBUG_PATHFIND mpr("Backtracking..."); #endif - std::vector<coord_def> path; + vector<coord_def> path; pos = target; path.push_back(pos); @@ -362,15 +362,15 @@ std::vector<coord_def> monster_pathfind::backtrack() // This is done because Crawl's pathfinding - once a target is in sight and easy // reach - is both very robust and natural, especially if we want to flexibly // avoid plants and other monsters in the way. -std::vector<coord_def> monster_pathfind::calc_waypoints() +vector<coord_def> monster_pathfind::calc_waypoints() { - std::vector<coord_def> path = backtrack(); + vector<coord_def> path = backtrack(); // If no path found, nothing to be done. if (path.empty()) return path; - std::vector<coord_def> waypoints; + vector<coord_def> waypoints; pos = path[0]; #ifdef DEBUG_PATHFIND @@ -512,7 +512,7 @@ void monster_pathfind::update_pos(coord_def npos, int total) // then call_add_new_pos. int old_total = dist[npos.x][npos.y] + estimated_cost(npos); - std::vector<coord_def> &vec = hash[old_total]; + vector<coord_def> &vec = hash[old_total]; for (unsigned int i = 0; i < vec.size(); i++) { if (vec[i] == npos) |