From 9682f84aedaeec5a4f86cd62f7ea7ad414670f31 Mon Sep 17 00:00:00 2001 From: PatR Date: Thu, 27 Oct 2022 15:55:57 -0700 Subject: [PATCH] more knockback induced dismount When looking at the previous commit, I realized that my comment about radius 1 was wrong. The original code prefers dismounting to spots that are orthogonal to the steed's position over diagonal ones. It doesn't say why. --- src/steed.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/steed.c b/src/steed.c index 72114dc18..4c3528029 100644 --- a/src/steed.c +++ b/src/steed.c @@ -512,11 +512,11 @@ landing_spot( ++viable; distance = distu(x, y); if (min_distance < 0 /* no viable candidate yet */ - /* or better than pending candidate (note: distance - is never less than min_distance because we're - limiting search to radius 1; j==0 won't get here - because 'min_distance < 0' will always pass for it) */ - || (distance < min_distance || (best_j != -1 && j == 0)) + /* or better than pending candidate (note: orthogonal + spots are distance 1 and diagonal ones distance 2; + treating one as better than the other is arbitary + and not wanted for DISMOUNT_KNOCKED) */ + || (best_j == -1) ? (distance < min_distance) : (j < 3) /* or equally good, maybe substitute this one */ || (distance == min_distance && !rn2(viable))) { /* traps avoided on pass 0; boulders avoided on 0 and 1 */