summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/travel.cc
diff options
context:
space:
mode:
authorzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2007-12-23 03:56:06 +0000
committerzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2007-12-23 03:56:06 +0000
commitba06b43178984f75b804f39732570b35e7900e7e (patch)
tree470090cb45e2d3ffb465578cba486a8c3f0d9c00 /crawl-ref/source/travel.cc
parent7ab388d144d5870c4a93f21d3c7f2c11e7aa05b6 (diff)
downloadcrawl-ref-ba06b43178984f75b804f39732570b35e7900e7e.tar.gz
crawl-ref-ba06b43178984f75b804f39732570b35e7900e7e.zip
Fixed anti-zigzag angle-bisection logic bug, reducint the worst case
scenario increase in auto-explroe turns from 20% to 13%. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@3110 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/travel.cc')
-rw-r--r--crawl-ref/source/travel.cc13
1 files changed, 8 insertions, 5 deletions
diff --git a/crawl-ref/source/travel.cc b/crawl-ref/source/travel.cc
index 07efdd4afe..8cbbc9740f 100644
--- a/crawl-ref/source/travel.cc
+++ b/crawl-ref/source/travel.cc
@@ -894,18 +894,22 @@ static void explore_find_target_square()
}
// If the two previous travel moves are perpendicular to each
- // other.
+ // other...
if (prev_travel_moves[0] != -1
&& prev_travel_moves[1] != -1
&& (abs(prev_travel_moves[1] - prev_travel_moves[0]) % 4) == 2)
{
+ ASSERT(anti_zigzag_dir == -1);
+
// Try moving along the line that bisects the right angle.
- if (abs(prev_travel_moves[0] - prev_travel_moves[1]) == 6)
- anti_zigzag_dir = 0;
+ if ((abs(prev_travel_moves[0] - prev_travel_moves[1]) == 6)
+ && (prev_travel_moves[0] + prev_travel_moves[1] == 8))
+ {
+ anti_zigzag_dir = 0;
+ }
else
anti_zigzag_dir = std::min(prev_travel_moves[0],
prev_travel_moves[1]) + 1;
-
}
// anti_zigzag_dir might have just been set, or might have
@@ -938,7 +942,6 @@ static void explore_find_target_square()
whereto.x, whereto.y) <= 5
&& distance(target.x, target.y,
whereto.x, whereto.y) <= 34)
- //&& t_dist - w_dist <= 14)
{
set_target_square(target);
return;