OSDN Git Service

update year to 2021
[jnethack/source.git] / src / engrave.c
index 9f75498..6867ab5 100644 (file)
@@ -1,11 +1,11 @@
-/* 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. */
 
 /* JNetHack Copyright */
 /* (c) Issei Numata, Naoki Hamada, Shigehiro Miyashita, 1994-2000  */
-/* For 3.4-, Copyright (c) SHIRAKATA Kentaro, 2002-2019            */
+/* For 3.4-, Copyright (c) SHIRAKATA Kentaro, 2002-2021            */
 /* JNetHack may be freely redistributed.  See license for details. */
 
 #include "hack.h"
@@ -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)
@@ -193,7 +194,7 @@ cant_reach_floor(x, y, up, check_pit)
 int x, y;
 boolean up, check_pit;
 {
-#if 0 /*JP*/
+#if 0 /*JP:T*/
     You("can't reach the %s.",
         up ? ceiling(x, y)
            : (check_pit && can_reach_floor(FALSE))
@@ -225,7 +226,7 @@ register int x, y;
 */
         return "\8bó\92\86";
     else if (is_pool(x, y))
-#if 0 /*JP*/
+#if 0 /*JP:T*/
         return (Underwater && !Is_waterlevel(&u.uz))
             ? "bottom" : hliquid("water");
 #else
@@ -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).
@@ -415,7 +416,7 @@ int x, y;
         case DUST:
             if (!Blind) {
                 sensed = 1;
-#if 0 /*JP*/
+#if 0 /*JP:T*/
                 pline("%s is written here in the %s.", Something,
                       is_ice(x, y) ? "frost" : "dust");
 #else
@@ -438,7 +439,7 @@ int x, y;
         case BURN:
             if (!Blind || can_reach_floor(TRUE)) {
                 sensed = 1;
-#if 0 /*JP*/
+#if 0 /*JP:T*/
                 pline("Some text has been %s into the %s here.",
                       is_ice(x, y) ? "melted" : "burned", surface(x, y));
 #else
@@ -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);
         }
     }
@@ -701,11 +707,11 @@ doengrave()
 /*JP
         You("tickle %s with %s.", mon_nam(u.ustuck), writer);
 */
-                You("%s\82Å%s\82ð\82­\82·\82®\82Á\82½\81D", writer, mon_nam(u.ustuck));
+        You("%s\82Å%s\82ð\82­\82·\82®\82Á\82½\81D", writer, mon_nam(u.ustuck));
 /*JP
         Your("message dissolves...");
 */
-                Your("\83\81\83b\83Z\81[\83W\82Í\8fÁ\82¦\82½\81D\81D\81D");
+        Your("\83\81\83b\83Z\81[\83W\82Í\8fÁ\82¦\82½\81D\81D\81D");
         return 0;
     }
     if (otmp->oclass != WAND_CLASS && !can_reach_floor(TRUE)) {
@@ -777,7 +783,7 @@ doengrave()
     case FOOD_CLASS:
     case SCROLL_CLASS:
     case SPBOOK_CLASS:
-#if 0 /*JP*/
+#if 0 /*JP:T*/
         pline("%s would get %s.", Yname2(otmp),
               is_ice(u.ux, u.uy) ? "all frosty" : "too dirty");
 #else
@@ -828,7 +834,7 @@ doengrave()
 /*JP
                     "The wand unsuccessfully fights your attempt to write!");
 */
-                       "\82 \82È\82½\82ª\8f\91\82±\82¤\82Æ\82·\82é\82Æ\8fñ\82Í\92ï\8dR\82µ\82½\81I");
+                    "\82 \82È\82½\82ª\8f\91\82±\82¤\82Æ\82·\82é\82Æ\8fñ\82Í\92ï\8dR\82µ\82½\81I");
                 break;
             case WAN_SLOW_MONSTER:
                 if (!Blind) {
@@ -939,10 +945,10 @@ doengrave()
                         pline("\82±\82ê\82Í\8c\8a\8c@\82è\82Ì\8fñ\82¾\81I");
                     doknown = TRUE;
                 }
-#if 0 /*JP*/
+#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 */
@@ -979,7 +987,7 @@ doengrave()
                         pline("\82±\82ê\82Í\89\8a\82Ì\8fñ\82¾\81I");
                     doknown = TRUE;
                 }
-#if 0 /*JP*/
+#if 0 /*JP:T*/
                 Strcpy(post_engr_text, Blind ? "You feel the wand heat up."
                                              : "Flames fly from the wand.");
 #else
@@ -1005,13 +1013,13 @@ doengrave()
                     Strcpy(post_engr_text, "\89Î\89Ô\82ª\8fñ\82©\82ç\94ò\82Ñ\8eU\82Á\82½\81D");
                     doblind = TRUE;
                 } else
-#if 0 /*JP*/
+#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;
@@ -1084,7 +1092,7 @@ doengrave()
 */
                         You("\83\81\83b\83Z\81[\83W\82ð\90@\82«\82Æ\82Á\82½\81D");
                     else
-#if 0 /*JP*/
+#if 0 /*JP:T*/
                         pline("%s %s.", Yobjnam2(otmp, "get"),
                               is_ice(u.ux, u.uy) ? "frosty" : "dusty");
 #else
@@ -1098,7 +1106,7 @@ doengrave()
 */
                     pline("\82±\82Ì\95\8e\9a\82Í%s\82Å\82Í\90@\82«\82Æ\82ê\82È\82¢\81D", xname(otmp));
             else
-#if 0 /*JP*/
+#if 0 /*JP:T*/
                 pline("%s %s.", Yobjnam2(otmp, "get"),
                       is_ice(u.ux, u.uy) ? "frosty" : "dusty");
 #else
@@ -1166,7 +1174,7 @@ doengrave()
         ptext = FALSE;
     }
     if (zapwand && (otmp->spe < 0)) {
-#if 0 /*JP*/
+#if 0 /*JP:T*/
         pline("%s %sturns to dust.", The(xname(otmp)),
               Blind ? "" : "glows violently, then ");
 #else
@@ -1174,7 +1182,7 @@ doengrave()
               Blind ? "" : "\8c\83\82µ\82­\8bP\82«\81C");
 #endif
         if (!IS_GRAVE(levl[u.ux][u.uy].typ))
-#if 0 /*JP*/
+#if 0 /*JP:T*/
             You(
     "are not going to get anywhere trying to write in the %s with your dust.",
                 is_ice(u.ux, u.uy) ? "frost" : "dust");
@@ -1223,7 +1231,7 @@ doengrave()
                 || oep->engr_type == ENGR_BLOOD
                 || oep->engr_type == MARK) {
                 if (!Blind) {
-#if 0 /*JP*/
+#if 0 /*JP:T*/
                     You("wipe out the message that was %s here.",
                         (oep->engr_type == DUST)
                             ? "written in the dust"
@@ -1245,14 +1253,15 @@ doengrave()
                      */
                     eow = TRUE;
             } else if (type == DUST || type == MARK || type == ENGR_BLOOD) {
-#if 0 /*JP*/
+#if 0 /*JP:T*/
                 You("cannot wipe out the message that is %s the %s here.",
                     oep->engr_type == BURN
                         ? (is_ice(u.ux, u.uy) ? "melted into" : "burned into")
                         : "engraved in",
                     surface(u.ux, u.uy));
 #else
-                You("%s\83\81\83b\83Z\81[\83W\82ð\90@\82«\82Æ\82ê\82È\82©\82Á\82½\81D",
+                You("%s\82É%s\83\81\83b\83Z\81[\83W\82ð\90@\82«\82Æ\82ê\82È\82©\82Á\82½\81D",
+                    surface(u.ux, u.uy),
                     oep->engr_type == BURN
                         ? (is_ice(u.ux, u.uy) ? "\8d\8f\82Ü\82ê\82Ä\82¢\82é" : "\8fÄ\82«\95t\82¯\82ç\82ê\82Ä\82¢\82é")
                         : "\8d\8f\82Ü\82ê\82Ä\82¢\82é");
@@ -1304,7 +1313,7 @@ doengrave()
         everb = (oep && !eow ? "\8d\8f\82Ý\89Á\82¦\82é" : "\8d\8f\82Þ");
         break;
     case BURN:
-#if 0 /*JP*/
+#if 0 /*JP:T*/
         everb = (oep && !eow
                      ? (is_ice(u.ux, u.uy) ? "add to the text melted into"
                                            : "add to the text burned into")
@@ -1337,7 +1346,7 @@ doengrave()
 */
         You("%s\82Å%s\82É%s\81D", doname(otmp), eloc, jpast(everb));
     else
-#if 0 /*JP*/
+#if 0 /*JP:T*/
         You("%s the %s with your %s.", everb, eloc, body_part(FINGERTIP));
 #else
         You("%s\82Å%s\82É%s\81D", body_part(FINGER), eloc, jpast(everb));
@@ -1361,7 +1370,7 @@ doengrave()
     if (len == 0 || index(ebuf, '\033')) {
         if (zapwand) {
             if (!Blind)
-#if 0 /*JP*/
+#if 0 /*JP:T*/
                 pline("%s, then %s.", Tobjnam(otmp, "glow"),
                       otense(otmp, "fade"));
 #else