]> granicus.if.org Git - nethack/commitdiff
Use proper locomotion when avoiding water or lava
authorPasi Kallinen <paxed@alt.org>
Sun, 13 Feb 2022 08:56:40 +0000 (10:56 +0200)
committerPasi Kallinen <paxed@alt.org>
Sun, 13 Feb 2022 08:56:40 +0000 (10:56 +0200)
include/extern.h
src/hack.c
src/hacklib.c

index 3dfa5573d7a1f629baf532e8ecc131808df2b00a..6e290ee489bdd9f56ffa1c594c646e5bfa10173f 100644 (file)
@@ -915,6 +915,7 @@ extern boolean test_move(int, int, int, int, int);
 extern int wiz_debug_cmd_traveldisplay(void);
 #endif
 extern boolean u_rooted(void);
+extern const char *u_locomotion(const char *);
 extern void domove(void);
 extern void runmode_delay_output(void);
 extern void overexert_hp(void);
index 69d0011c11aa79b5a425ec2d58be930dcdace361..5837fcd1f625f2b59d41c557d9dab23bc08fe693 100644 (file)
@@ -1520,6 +1520,14 @@ check_buried_zombies(xchar x, xchar y)
     }
 }
 
+const char *
+u_locomotion(const char *def)
+{
+    return Levitation ? "levitate"
+        : Flying ? "fly"
+        : locomotion(g.youmonst.data, def);
+}
+
 /* Is it dangerous for hero to move to x,y due to water or lava? */
 static boolean
 swim_move_danger(xchar x, xchar y)
@@ -1546,7 +1554,8 @@ swim_move_danger(xchar x, xchar y)
                 g.context.swim_tip = TRUE;
                 return FALSE;
             } else if (ParanoidSwim) {
-                You("avoid stepping into the %s.",
+                You("avoid %s into the %s.",
+                    ing_suffix(u_locomotion("step")),
                     waterbody_name(x, y));
                 if (!g.context.swim_tip) {
                     pline("(Use '%s' prefix to step in if you really want to.)",
index 93e4565f1b76f5730cbe1cb502a17552beec3e07..d8df82dcc046897b41c5558fdacbb8f4b0f1c3a7 100644 (file)
@@ -349,7 +349,9 @@ ing_suffix(const char *s)
         Strcpy(onoff, p);
         *p = '\0';
     }
-    if (p >= &buf[3] && !index(vowel, *(p - 1))
+    if (p >= &buf[2] && !strcmpi(p - 2, "er")) { /* slither + ing */
+        /* nothing here */
+    } else if (p >= &buf[3] && !index(vowel, *(p - 1))
         && index(vowel, *(p - 2)) && !index(vowel, *(p - 3))) {
         /* tip -> tipp + ing */
         *p = *(p - 1);