From 6a13ecaf1221cf299a576292150f0f0777cd1f4e Mon Sep 17 00:00:00 2001 From: PatR Date: Wed, 8 Mar 2023 14:35:24 -0800 Subject: [PATCH] \#retravel feedback Using #retravel when no destination was set up just silenty finished, effectively a no-op. Could happen for the first travel attempt on the current dungeon level, or after most recent #travel successfully reached and cleared its destination. Using #retravel when already at previously set but unreached--via travel--destination, or explicitly picking your own spot as travel destination using #travel, actually traveled from your current spot to the same spot. Usually nothing interesting occurred and you got no feedback. However, if you happened to be stuck in a trap at that spot you tried to walk out of it and got trap feedback about that. (Then probably right back into the trap if you succeeded in escaping it. I didn't try to test that.) --- src/cmd.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/cmd.c b/src/cmd.c index ca6bf86d8..1ab61e580 100644 --- a/src/cmd.c +++ b/src/cmd.c @@ -1,4 +1,4 @@ -/* NetHack 3.7 cmd.c $NHDT-Date: 1671222065 2022/12/16 20:21:05 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.650 $ */ +/* NetHack 3.7 cmd.c $NHDT-Date: 1678312816 2023/03/08 22:00:16 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.666 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2013. */ /* NetHack may be freely redistributed. See license for details. */ @@ -6475,7 +6475,7 @@ dotravel(void) coord cc; /* - * Travelling used to be a no-op if user toggled 'travel' option + * Traveling used to be a no-op if user toggled 'travel' option * Off. However, travel was initially implemented as a mouse-only * command and the original purpose of the option was to be able * to prevent clicks on the map from initiating travel. @@ -6521,8 +6521,17 @@ dotravel(void) static int dotravel_target(void) { - if (!isok(iflags.travelcc.x, iflags.travelcc.y)) + if (!isok(iflags.travelcc.x, iflags.travelcc.y)) { + /* assume <0,0>, the value assigned when travel reaches destination */ + pline("No travel destination set."); return ECMD_OK; + } else if (u_at(iflags.travelcc.x, iflags.travelcc.y)) { + /* maybe interrupted while traveling then just walked rest of way + so destination hasn't been reset yet */ + You("are already here."); + iflags.travelcc.x = iflags.travelcc.y = 0; + return ECMD_OK; + } iflags.getloc_travelmode = FALSE;