diff --git a/dat/keyhelp b/dat/keyhelp index 41ab37ef1..d4df8d444 100644 --- a/dat/keyhelp +++ b/dat/keyhelp @@ -14,12 +14,12 @@ is reporting the wrong character but will be operating correctly if it describes ^J when you type ^M. - A NUL character, typed as ^ on some keyboards, ^@ on others, - and maybe not typeable at all on yet others. It is not used as a - command, and will be converted into ESC before reaching 'whatdoes'. - Unlike ^M, this transformation is performed by NetHack itself. - But like ^M, if you type NUL and get feedback about ESC, the - situation is expected. + A NUL character, which is typed as ^ on some keyboards, + ^@ on others, and maybe not typeable at all on yet others, is not + used as a command, and will be converted into ESC before reaching + 'whatdoes'. Unlike ^M, this transformation is performed within + NetHack. But like ^M, if you type NUL and get feedback about ESC, + the situation is expected. ESC itself is a synonym for ^[, and is another source of oddity. Various function keys, including cursor arrow keys, may transmit diff --git a/src/cmd.c b/src/cmd.c index 317405b45..a1020bdba 100644 --- a/src/cmd.c +++ b/src/cmd.c @@ -920,6 +920,7 @@ wiz_map_levltyp(VOID_ARGS) ? 'a' + terrain - 10 : 'A' + terrain - 36); } + x--; if (levl[0][y].typ != STONE || may_dig(0, y)) row[x++] = '!'; row[x] = '\0'; diff --git a/src/do_wear.c b/src/do_wear.c index e588e5413..15f00bbee 100644 --- a/src/do_wear.c +++ b/src/do_wear.c @@ -1484,6 +1484,10 @@ int cursed(otmp) register struct obj *otmp; { + if (!otmp) { + impossible("cursed without otmp"); + return 0; + } /* Curses, like chickens, come home to roost. */ if ((otmp == uwep) ? welded(otmp) : (int) otmp->cursed) { boolean use_plural = (is_boots(otmp) || is_gloves(otmp) diff --git a/src/objnam.c b/src/objnam.c index 7a800d23a..af3cc2511 100644 --- a/src/objnam.c +++ b/src/objnam.c @@ -2839,11 +2839,12 @@ struct obj *no_wish; */ if (!strstri(bp, "wand ") && !strstri(bp, "spellbook ") && !strstri(bp, "finger ")) { - if (((p = strstri(bp, "tin of ")) != 0) - && (tmp = tin_variety_txt(p + 7, &tinv)) - && (mntmp = name_to_mon(p + 7 + tmp)) >= LOW_PM) { - *(p + 3) = 0; + if ((p = strstri(bp, "tin of ")) != 0) { + tmp = tin_variety_txt(p + 7, &tinv); tvariety = tinv; + mntmp = name_to_mon(p + 7 + tmp); + typ = TIN; + goto typfnd; } else if ((p = strstri(bp, " of ")) != 0 && (mntmp = name_to_mon(p + 4)) >= LOW_PM) *p = 0; diff --git a/sys/unix/nethack.sh b/sys/unix/nethack.sh index 47d0da861..eec1991d6 100755 --- a/sys/unix/nethack.sh +++ b/sys/unix/nethack.sh @@ -4,8 +4,6 @@ HACKDIR=/usr/games/lib/nethackdir export HACKDIR HACK=$HACKDIR/nethack -# NB: MAXNROFPLAYERS is deprecated in favor of MAXPLAYERS in SYSCF. -MAXNROFPLAYERS=4 # Since Nethack.ad is installed in HACKDIR, add it to XUSERFILESEARCHPATH case "x$XUSERFILESEARCHPATH" in @@ -65,11 +63,4 @@ fi cd $HACKDIR -case $1 in - -s*) - exec $HACK "$@" - ;; - *) - exec $HACK "$@" $MAXNROFPLAYERS - ;; -esac +exec $HACK "$@" diff --git a/sys/unix/unixmain.c b/sys/unix/unixmain.c index 2d6452ce8..1c0d55f90 100644 --- a/sys/unix/unixmain.c +++ b/sys/unix/unixmain.c @@ -419,10 +419,14 @@ char *argv[]; } } - /* XXX This is deprecated in favor of SYSCF with MAXPLAYERS. Make - * an error in next release. */ +#ifdef SYSCF + if (argc > 1) + raw_printf("MAXPLAYERS are set in sysconf file.\n"); +#else + /* XXX This is deprecated in favor of SYSCF with MAXPLAYERS */ if (argc > 1) locknum = atoi(argv[1]); +#endif #ifdef MAX_NR_OF_PLAYERS /* limit to compile-time limit */ if (!locknum || locknum > MAX_NR_OF_PLAYERS) diff --git a/win/tty/wintty.c b/win/tty/wintty.c index e38e3e7c8..adec33c22 100644 --- a/win/tty/wintty.c +++ b/win/tty/wintty.c @@ -2448,19 +2448,22 @@ const char *str; topline wrapping converts space at wrap point into newline, we reverse that here */ if ((int) strlen(str) >= CO || index(str, '\n')) { - register const char *bp0 = str; - char c, nxtc, *bp1 = cbuf, *endbp1 = &cbuf[sizeof cbuf - 1]; + const char *in_str = str; + char c, *outstr = cbuf, *outend = &cbuf[sizeof cbuf - 1]; + boolean was_space = TRUE; /* True discards all leading spaces; + False would retain one if present */ - cbuf[0] = cbuf[sizeof cbuf - 1] = '\0'; /* superfluous */ - nxtc = (*bp0 == '\n') ? ' ' : *bp0; - do { - c = nxtc; - nxtc = bp0[1]; - if (nxtc == '\n') - nxtc = ' '; - if (c != ' ' || nxtc != ' ') - *bp1++ = c; - } while (*bp0++ && bp1 < endbp1); + while ((c = *in_str++) != '\0' && outstr < outend) { + if (c == '\n') + c = ' '; + if (was_space && c == ' ') + continue; + *outstr++ = c; + was_space = (c == ' '); + } + if ((was_space && outstr > cbuf) || outstr == outend) + --outstr; /* remove trailing space or make room for terminator */ + *outstr = '\0'; str = cbuf; } return str;