OSDN Git Service

upgrade to 3.6.6
[jnethack/source.git] / src / engrave.c
index 0150126..480411d 100644 (file)
@@ -1,4 +1,4 @@
-/* NetHack 3.6 engrave.c       $NHDT-Date: 1456304550 2016/02/24 09:02:30 $  $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.61 $ */
+/* NetHack 3.6 engrave.c       $NHDT-Date: 1570318925 2019/10/05 23:42:05 $  $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.75 $ */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /*-Copyright (c) Robert Patrick Rankin, 2012. */
 /* NetHack may be freely redistributed.  See license for details. */
@@ -178,7 +178,8 @@ boolean check_pit;
     if (u.usteed && P_SKILL(P_RIDING) < P_BASIC)
         return FALSE;
     if (check_pit && !Flying
-        && (t = t_at(u.ux, u.uy)) != 0 && uteetering_at_seen_pit(t))
+        && (t = t_at(u.ux, u.uy)) != 0
+        && (uteetering_at_seen_pit(t) || uescaped_shaft(t)))
         return FALSE;
 
     return (boolean) ((!Levitation || Is_airlevel(&u.uz)
@@ -378,7 +379,8 @@ int cnt;
 
 void
 wipe_engr_at(x, y, cnt, magical)
-xchar x, y, cnt, magical;
+xchar x, y, cnt;
+boolean magical;
 {
     register struct engr *ep = engr_at(x, y);
 
@@ -405,7 +407,6 @@ int x, y;
 {
     register struct engr *ep = engr_at(x, y);
     int sensed = 0;
-    char buf[BUFSZ];
 
     /* Sensing an engraving does not require sight,
      * nor does it necessarily imply comprehension (literacy).
@@ -474,23 +475,28 @@ int x, y;
             impossible("%s is written in a very strange way.", Something);
             sensed = 1;
         }
+
         if (sensed) {
-            char *et;
+            char *et, buf[BUFSZ];
+            int maxelen = (int) (sizeof buf
+                                 /* sizeof "literal" counts terminating \0 */
 /*JP
-            unsigned maxelen = BUFSZ - sizeof("You feel the words: \"\". ");
+                                 - sizeof "You feel the words: \"\".");
 */
-            unsigned maxelen = BUFSZ - sizeof("\82 \82È\82½\82Í\8e\9f\82Ì\82æ\82¤\82É\8a´\82\82½\81F\81u\81v");
-            if (strlen(ep->engr_txt) > maxelen) {
-                (void) strncpy(buf, ep->engr_txt, (int) maxelen);
+                                 - sizeof "\82 \82È\82½\82Í\8e\9f\82Ì\82æ\82¤\82É\8a´\82\82½\81F\81u\81v");
+
+            if ((int) strlen(ep->engr_txt) > maxelen) {
+                (void) strncpy(buf, ep->engr_txt, maxelen);
                 buf[maxelen] = '\0';
                 et = buf;
-            } else
+            } else {
                 et = ep->engr_txt;
+            }
 /*JP
             You("%s: \"%s\".", (Blind) ? "feel the words" : "read", et);
 */
             You("%s\81F\81u%s\81v", (Blind) ? "\8e\9f\82Ì\82æ\82¤\82É\8a´\82\82½" : "\93Ç\82ñ\82¾",  et);
-            if (context.run > 1)
+            if (context.run > 0)
                 nomul(0);
         }
     }
@@ -942,7 +948,7 @@ doengrave()
 #if 0 /*JP:T*/
                 Strcpy(post_engr_text,
                        (Blind && !Deaf)
-                          ? "You hear drilling!"
+                          ? "You hear drilling!"    /* Deaf-aware */
                           : Blind
                              ? "You feel tremors."
                              : IS_GRAVE(levl[u.ux][u.uy].typ)
@@ -955,16 +961,18 @@ doengrave()
                                        : "Gravel flies up from the floor.");
 #else
                 Strcpy(post_engr_text,
-                       Blind
-                          ? "\8c\8a\82ª\8aJ\82­\89¹\82ð\95·\82¢\82½\81I"
-                          : IS_GRAVE(levl[u.ux][u.uy].typ)
-                             ? "\95æ\90Î\82©\82ç\94j\95Ð\82ª\94ò\82Ñ\8eU\82Á\82½\81D"
-                             : is_ice(u.ux,u.uy)
-                                ? "\95X\82Ì\95\\96Ê\82©\82ç\95X\82Ì\82©\82¯\82ç\82ª\94ò\82Ñ\8eU\82Á\82½\81D"
-                                : (level.locations[u.ux][u.uy].typ
-                                   == DRAWBRIDGE_DOWN)
-                                   ? "\94j\95Ð\82ª\8b´\82©\82ç\95\91\82¢\82 \82ª\82Á\82½\81D"
-                                   : "\8d»\97\98\82ª\8f°\82©\82ç\94ò\82Ñ\8eU\82Á\82½\81D");
+                       (Blind && !Deaf)
+                          ? "\8c\8a\82ª\8aJ\82­\89¹\82ð\95·\82¢\82½\81I"    /* Deaf-aware */
+                          : Blind
+                             ? "\90U\93®\82ð\8a´\82\82½\81D"
+                             : IS_GRAVE(levl[u.ux][u.uy].typ)
+                                ? "\95æ\90Î\82©\82ç\94j\95Ð\82ª\94ò\82Ñ\8eU\82Á\82½\81D"
+                                : is_ice(u.ux,u.uy)
+                                   ? "\95X\82Ì\95\\96Ê\82©\82ç\95X\82Ì\82©\82¯\82ç\82ª\94ò\82Ñ\8eU\82Á\82½\81D"
+                                   : (level.locations[u.ux][u.uy].typ
+                                      == DRAWBRIDGE_DOWN)
+                                      ? "\94j\95Ð\82ª\8b´\82©\82ç\95\91\82¢\82 \82ª\82Á\82½\81D"
+                                      : "\8d»\97\98\82ª\8f°\82©\82ç\94ò\82Ñ\8eU\82Á\82½\81D");
 #endif
                 break;
             /* type = BURN wands */
@@ -1007,11 +1015,11 @@ doengrave()
                 } else
 #if 0 /*JP:T*/
                     Strcpy(post_engr_text, !Deaf
-                                ? "You hear crackling!"
+                                ? "You hear crackling!"  /* Deaf-aware */
                                 : "Your hair stands up!");
 #else
                     Strcpy(post_engr_text, !Deaf
-                                ? "\83p\83`\83p\83`\82Æ\82¢\82¤\89¹\82ð\95·\82¢\82½\81I"
+                                ? "\83p\83`\83p\83`\82Æ\82¢\82¤\89¹\82ð\95·\82¢\82½\81I"  /* Deaf-aware */
                                 : "\83]\83b\82Æ\82µ\82½\81I");
 #endif
                 break;