From ce0107aff9c82ec7ba6bcfdc5b371f89f67af306 Mon Sep 17 00:00:00 2001 From: Michael Meyer Date: Thu, 28 Jul 2022 11:48:05 -0400 Subject: [PATCH] Restore old behavior for running onto trap The refactor of domove made it impossible to run onto a trap (or water, if blind), even in the shift-dir mode where the hero is meant to stop only upon "hitting a wall or running into something". I use this runmode to sprint large distances across the map, and the change to this behavior meant that it was no longer possible to press shift-dir again to continue past the trap. This restores the old behavior of allowing shift-dir running to carry you onto a trap (though the hero will still stop before hitting a trap in less breakneck runmodes). --- src/hack.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/hack.c b/src/hack.c index 139a15d2b..653e89241 100644 --- a/src/hack.c +++ b/src/hack.c @@ -2149,18 +2149,16 @@ avoid_moving_on_liquid( static boolean avoid_running_into_trap_or_liquid(coordxy x, coordxy y) { + boolean would_stop = (g.context.run >= 2); if (!g.context.run) return FALSE; - if (avoid_moving_on_trap(x,y, TRUE)) { + if (avoid_moving_on_trap(x,y, would_stop) + || (Blind && avoid_moving_on_liquid(x,y, would_stop))) { nomul(0); - g.context.move = 0; - return TRUE; - } - if (Blind && avoid_moving_on_liquid(x,y, TRUE)) { - nomul(0); - g.context.move = 0; - return TRUE; + if (would_stop) + g.context.move = 0; + return would_stop; } return FALSE; }