]> granicus.if.org Git - nethack/commitdiff
fix #H4597 - sitting on level teleport trap
authorPatR <rankin@nethack.org>
Fri, 9 Dec 2016 01:22:59 +0000 (17:22 -0800)
committerPatR <rankin@nethack.org>
Fri, 9 Dec 2016 01:22:59 +0000 (17:22 -0800)
During #sit:  "You sit down.  You step on a level teleporter."
Switch to alternate phrasing for #sit.

Webs and polymorph traps had similar issues.

doc/fixes36.1
include/extern.h
include/hack.h
src/sit.c
src/teleport.c
src/trap.c

index 28aa198acddf485fd7f25c17ac8cb45b62e1f4d6..7142c52ca9542493a72eaecac8e0e763eed09474 100644 (file)
@@ -362,6 +362,8 @@ movement speeds are made less predictable by using random rounding, rather
        than via adding a random offset
 some death by the-poison-was-deadly situations left stale non-zero HP shown
        on the status line during final disclosure
+when sitting at a trap spot: You sit down. You step on a level teleporter.
+       (likewise for polymorph trap, and similar issue for web)
 
 
 Fixes to Post-3.6.0 Problems that Were Exposed Via git Repository
index 5a229a8da16c3823614b7f1f1d01379797881e0b..52b810a60128689f94ecab57855a1890c7e78d84 100644 (file)
@@ -2282,8 +2282,8 @@ E boolean FDECL(stucksteed, (BOOLEAN_P));
 
 E boolean FDECL(goodpos, (int, int, struct monst *, unsigned));
 E boolean FDECL(enexto, (coord *, XCHAR_P, XCHAR_P, struct permonst *));
-E boolean
-FDECL(enexto_core, (coord *, XCHAR_P, XCHAR_P, struct permonst *, unsigned));
+E boolean FDECL(enexto_core, (coord *, XCHAR_P, XCHAR_P,
+                              struct permonst *, unsigned));
 E void FDECL(teleds, (int, int, BOOLEAN_P));
 E boolean FDECL(safe_teleds, (BOOLEAN_P));
 E boolean FDECL(teleport_pet, (struct monst *, BOOLEAN_P));
@@ -2293,13 +2293,13 @@ E int NDECL(dotele);
 E void NDECL(level_tele);
 E void FDECL(domagicportal, (struct trap *));
 E void FDECL(tele_trap, (struct trap *));
-E void FDECL(level_tele_trap, (struct trap *));
+E void FDECL(level_tele_trap, (struct trap *, unsigned));
 E void FDECL(rloc_to, (struct monst *, int, int));
 E boolean FDECL(rloc, (struct monst *, BOOLEAN_P));
 E boolean FDECL(tele_restrict, (struct monst *));
 E void FDECL(mtele_trap, (struct monst *, struct trap *, int));
-E int FDECL(mlevel_tele_trap,
-            (struct monst *, struct trap *, BOOLEAN_P, int));
+E int FDECL(mlevel_tele_trap, (struct monst *, struct trap *,
+                               BOOLEAN_P, int));
 E boolean FDECL(rloco, (struct obj *));
 E int NDECL(random_teleport_level);
 E boolean FDECL(u_teleport_mon, (struct monst *, BOOLEAN_P));
index cc878942ce1e5f0ad8697d3e0ab3ca63b53ebebb..bf2273b2b8133191e3e5889372b0c1ec0fbde1e6 100644 (file)
@@ -296,9 +296,9 @@ enum hmon_atkmode_types {
 #define FORCETRAP 0x01     /* triggering not left to chance */
 #define NOWEBMSG 0x02      /* suppress stumble into web message */
 #define FORCEBUNGLE 0x04   /* adjustments appropriate for bungling */
-#define RECURSIVETRAP 0x08 /* trap changed into another type this same turn \
-                              */
+#define RECURSIVETRAP 0x08 /* trap changed into another type this same turn */
 #define TOOKPLUNGE 0x10    /* used '>' to enter pit below you */
+#define VIASITTING 0x20    /* #sit while at trap location (affects message) */
 
 /* Flags to control test_move in hack.c */
 #define DO_MOVE 0   /* really doing the move */
index 047e223380384185d7ed70199bc0c826c63f8bba..a6c6a0906855a159edba3c17a573fe4a8017cc9e 100644 (file)
--- a/src/sit.c
+++ b/src/sit.c
@@ -113,7 +113,7 @@ dosit()
             }
         } else {
             You("sit down.");
-            dotrap(trap, 0);
+            dotrap(trap, VIASITTING);
         }
     } else if (Underwater || Is_waterlevel(&u.uz)) {
         if (Is_waterlevel(&u.uz))
index 5c42151a6753916490e2db284b901f97f9d6f5d7..8fb3f8c842733d3f31dc61cdd8d1a6424c4bf732 100644 (file)
@@ -872,12 +872,20 @@ struct trap *trap;
 }
 
 void
-level_tele_trap(trap)
+level_tele_trap(trap, trflags)
 struct trap *trap;
+unsigned trflags;
 {
-    You("%s onto a level teleport trap!",
-        Levitation ? (const char *) "float"
-                   : locomotion(youmonst.data, "step"));
+    char verbbuf[BUFSZ];
+
+    if ((trflags & VIASITTING) != 0)
+        Strcpy(verbbuf, "trigger"); /* follows "You sit down." */
+    else
+        Sprintf(verbbuf, "%s onto",
+                Levitation ? (const char *) "float"
+                           : locomotion(youmonst.data, "step"));
+    You("%s a level teleport trap!", verbbuf);
+
     if (Antimagic) {
         shieldeff(u.ux, u.uy);
     }
index 23e26dec3b121ce0074ac535e096c79738f0e0dd..0df86b1d7a5a8033daf838dbfcbd12267546ba5e 100644 (file)
@@ -850,6 +850,7 @@ unsigned trflags;
             webmsgok = (trflags & NOWEBMSG) == 0,
             forcebungle = (trflags & FORCEBUNGLE) != 0,
             plunged = (trflags & TOOKPLUNGE) != 0,
+            viasitting = (trflags & VIASITTING) != 0,
             adj_pit = conjoined_pits(trap, t_at(u.ux0, u.uy0), TRUE);
     int oldumort;
     int steed_article = ARTICLE_THE;
@@ -1237,7 +1238,7 @@ unsigned trflags;
 
     case LEVEL_TELEP:
         seetrap(trap);
-        level_tele_trap(trap);
+        level_tele_trap(trap, trflags);
         break;
 
     case WEB: /* Our luckless player has stumbled into a web. */
@@ -1253,7 +1254,7 @@ unsigned trflags;
         if (webmsgok) {
             char verbbuf[BUFSZ];
 
-            if (forcetrap) {
+            if (forcetrap || viasitting) {
                 Strcpy(verbbuf, "are caught by");
             } else if (u.usteed) {
                 Sprintf(verbbuf, "lead %s into",
@@ -1382,15 +1383,17 @@ unsigned trflags;
         char verbbuf[BUFSZ];
 
         seetrap(trap);
-        if (u.usteed)
-            Sprintf(verbbuf, "lead %s",
+        if (viasitting)
+            Strcpy(verbbuf, "trigger"); /* follows "You sit down." */
+        else if (u.usteed)
+            Sprintf(verbbuf, "lead %s onto",
                     x_monnam(u.usteed, steed_article, (char *) 0,
                              SUPPRESS_SADDLE, FALSE));
         else
-            Sprintf(verbbuf, "%s", Levitation
-                                       ? (const char *) "float"
-                                       : locomotion(youmonst.data, "step"));
-        You("%s onto a polymorph trap!", verbbuf);
+            Sprintf(verbbuf, "%s onto",
+                    Levitation ? (const char *) "float"
+                               : locomotion(youmonst.data, "step"));
+        You("%s a polymorph trap!", verbbuf);
         if (Antimagic || Unchanging) {
             shieldeff(u.ux, u.uy);
             You_feel("momentarily different.");