Merge branch 'NetHack-3.6'

This commit is contained in:
nhmall
2019-10-06 09:16:23 -04:00
14 changed files with 91 additions and 87 deletions

View 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. */
@@ -316,7 +316,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).
@@ -365,17 +364,22 @@ int x, y;
impossible("%s is written in a very strange way.", Something);
sensed = 1;
}
if (sensed) {
char *et;
unsigned maxelen = BUFSZ - sizeof("You feel the words: \"\". ");
if (strlen(ep->engr_txt) > maxelen) {
(void) strncpy(buf, ep->engr_txt, (int) maxelen);
char *et, buf[BUFSZ];
int maxelen = (int) (sizeof buf
/* sizeof "literal" counts terminating \0 */
- sizeof "You feel the words: \"\".");
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;
}
You("%s: \"%s\".", (Blind) ? "feel the words" : "read", et);
if (g.context.run > 1)
if (g.context.run > 0)
nomul(0);
}
}