Merge remote-tracking branch 'origin/NetHack-3.6.0'
This commit is contained in:
@@ -368,6 +368,8 @@ add option status_updates to prevent bottom of screen status line updates
|
||||
fix achievement recording bug with mines and sokoban prizes
|
||||
g.cubes would eat globs of green slime without harm; engulf those instead
|
||||
fix up true rumor about rock moles vs boots
|
||||
Bell of Opening could trigger segfault attempting to open some types of traps
|
||||
if hero was mounted
|
||||
|
||||
|
||||
Fixes to Post-3.6.0 Problems that Were Exposed Via git Repository
|
||||
@@ -398,6 +400,9 @@ DUMPLOG: genocided and extinct species was always a blank line;
|
||||
vanquished creatures was just a blank line if nothing had been killed
|
||||
DUMPLOG: RIP tombstone was printed for characters who survived (ascended,
|
||||
escaped dungeon, quit, trickery or panic)
|
||||
artifact creation violated illiterate conduct when artifact name was assigned,
|
||||
behavior intended only for creating Sting or Orcrist via naming
|
||||
tty: revert to pline() for issuing prompts (override MSGTYPE=hide differently)
|
||||
|
||||
|
||||
Platform- and/or Interface-Specific Fixes
|
||||
@@ -422,6 +427,7 @@ tty: if "--More--" was written to leftmost column (beginning of second line)
|
||||
of status line instead back on map) after message line was cleared
|
||||
tty: long message lines which wrap when shown on the top line might be
|
||||
re-displayed incorrectly by ^P for msg_window={full,combo,reverse}
|
||||
tty: MSGTYPE=hide could interfere with display of prompts
|
||||
unix/X11: in top level Makefile, some commented out definitions of VARDATND
|
||||
misspelled pilemark.xbm (as pilemark.xpm)
|
||||
unix: options file with CR+LF line ends and an invalid option line resulted in
|
||||
@@ -566,7 +572,8 @@ Ray Chason's MS-DOS port restored to functionality with credit to Reddit user
|
||||
Ray Chason's MSDOS port support for some VESA modes
|
||||
Darshan Shaligram's pet ranged attack
|
||||
Jason Dorje Short's key rebinding
|
||||
Maxime Bacoux's new dumplog
|
||||
Maxime Bacoux's new DUMPLOG: compile-time option to enable logging of
|
||||
end-of-game information into a text file
|
||||
|
||||
|
||||
Code Cleanup and Reorganization
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.6 extern.h $NHDT-Date: 1489192904 2017/03/11 00:41:44 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.583 $ */
|
||||
/* NetHack 3.6 extern.h $NHDT-Date: 1490908458 2017/03/30 21:14:18 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.585 $ */
|
||||
/* Copyright (c) Steve Creps, 1988. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
|
||||
@@ -211,7 +211,7 @@ E int FDECL(isok, (int, int));
|
||||
E int FDECL(get_adjacent_loc,
|
||||
(const char *, const char *, XCHAR_P, XCHAR_P, coord *));
|
||||
E const char *FDECL(click_to_cmd, (int, int, int));
|
||||
E char FDECL(get_count, (char *, CHAR_P, long, long *));
|
||||
E char FDECL(get_count, (char *, CHAR_P, long, long *, BOOLEAN_P));
|
||||
#ifdef HANGUPHANDLING
|
||||
E void FDECL(hangup, (int));
|
||||
E void NDECL(end_of_input);
|
||||
@@ -1809,6 +1809,7 @@ E void FDECL(dumplogmsg, (const char *));
|
||||
E void NDECL(dumplogfreemessages);
|
||||
#endif
|
||||
E void VDECL(pline, (const char *, ...)) PRINTF_F(1, 2);
|
||||
E void VDECL(custompline, (unsigned, const char *, ...)) PRINTF_F(2, 3);
|
||||
E void VDECL(Norep, (const char *, ...)) PRINTF_F(1, 2);
|
||||
E void NDECL(free_youbuf);
|
||||
E void VDECL(You, (const char *, ...)) PRINTF_F(1, 2);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.6 hack.h $NHDT-Date: 1451683048 2016/01/01 21:17:28 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.68 $ */
|
||||
/* NetHack 3.6 hack.h $NHDT-Date: 1490908464 2017/03/30 21:14:24 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.76 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
|
||||
@@ -359,6 +359,12 @@ enum explosion_types {
|
||||
#define XKILL_NOCORPSE 2
|
||||
#define XKILL_NOCONDUCT 4
|
||||
|
||||
/* pline_flags; mask values for custompline()'s first argument */
|
||||
/* #define PLINE_ORDINARY 0 */
|
||||
#define PLINE_NOREPEAT 1
|
||||
#define OVERRIDE_MSGTYPE 2
|
||||
#define SUPPRESS_HISTORY 4
|
||||
|
||||
/* Macros for messages referring to hands, eyes, feet, etc... */
|
||||
enum bodypart_types {
|
||||
ARM = 0,
|
||||
|
||||
61
src/cmd.c
61
src/cmd.c
@@ -2737,24 +2737,18 @@ int final;
|
||||
/* Macros for meta and ctrl modifiers:
|
||||
* M and C return the meta/ctrl code for the given character;
|
||||
* e.g., (C('c') is ctrl-c
|
||||
* ISMETA and ISCTRL return TRUE iff the code is a meta/ctrl code
|
||||
* UNMETA and UNCTRL are the opposite of M/C and return the key for a given
|
||||
* meta/ctrl code. */
|
||||
*/
|
||||
#ifndef M
|
||||
#ifndef NHSTDC
|
||||
#define M(c) (0x80 | (c))
|
||||
#else
|
||||
#define M(c) ((c) -128)
|
||||
#define M(c) ((c) - 128)
|
||||
#endif /* NHSTDC */
|
||||
#endif
|
||||
#define ISMETA(c) (((c) & 0x80) != 0)
|
||||
#define UNMETA(c) ((c) & 0x7f)
|
||||
|
||||
#ifndef C
|
||||
#define C(c) (0x1f & (c))
|
||||
#endif
|
||||
#define ISCTRL(c) ((uchar)(c) < 0x20)
|
||||
#define UNCTRL(c) (ISCTRL(c) ? (0x60 | (c)) : (c))
|
||||
|
||||
/* ordered by command name */
|
||||
struct ext_func_tab extcmdlist[] = {
|
||||
@@ -3727,27 +3721,25 @@ char *txt;
|
||||
return '\0';
|
||||
}
|
||||
|
||||
/* returns the text for a one-byte encoding
|
||||
/* returns the text for a one-byte encoding;
|
||||
* must be shorter than a tab for proper formatting */
|
||||
char *
|
||||
key2txt(c, txt)
|
||||
uchar c;
|
||||
char *txt; /* sufficiently long buffer */
|
||||
{
|
||||
/* should probably switch to "SPC", "ESC", "RET"
|
||||
since nethack's documentation uses ESC for <escape> */
|
||||
if (c == ' ')
|
||||
Sprintf(txt, "<space>");
|
||||
else if (c == '\033')
|
||||
Sprintf(txt, "<esc>");
|
||||
else if (c == '\n')
|
||||
Sprintf(txt, "<enter>");
|
||||
else if (ISCTRL(c))
|
||||
Sprintf(txt, "^%c", highc(UNCTRL(c)));
|
||||
else if (ISMETA(c))
|
||||
Sprintf(txt, "M-%c", UNMETA(c));
|
||||
else if (c >= 33 && c <= 126)
|
||||
Sprintf(txt, "%c", c); /* regular keys: ! through ~ */
|
||||
else if (c == '\177')
|
||||
Sprintf(txt, "<del>"); /* "<delete>" won't fit */
|
||||
else
|
||||
Sprintf(txt, "A-%i", c); /* arbitrary ascii combinations */
|
||||
Strcpy(txt, visctrl((char) c));
|
||||
return txt;
|
||||
}
|
||||
|
||||
@@ -4579,11 +4571,12 @@ int x, y, mod;
|
||||
}
|
||||
|
||||
char
|
||||
get_count(allowchars, inkey, maxcount, count)
|
||||
get_count(allowchars, inkey, maxcount, count, historical)
|
||||
char *allowchars;
|
||||
char inkey;
|
||||
long maxcount;
|
||||
long *count;
|
||||
boolean historical; /* whether to include in message history: True => yes */
|
||||
{
|
||||
char qbuf[QBUFSZ];
|
||||
int key;
|
||||
@@ -4624,10 +4617,19 @@ long *count;
|
||||
Sprintf(qbuf, "Count: %ld", cnt);
|
||||
backspaced = FALSE;
|
||||
}
|
||||
pline1(qbuf);
|
||||
/* bypassing pline() keeps intermediate prompt out of
|
||||
DUMPLOG message history */
|
||||
putstr(WIN_MESSAGE, 0, qbuf);
|
||||
mark_synch();
|
||||
}
|
||||
}
|
||||
|
||||
if (historical) {
|
||||
Sprintf(qbuf, "Count: %ld ", *count);
|
||||
(void) key2txt((uchar) key, eos(qbuf));
|
||||
putmsghistory(qbuf, FALSE);
|
||||
}
|
||||
|
||||
return key;
|
||||
}
|
||||
|
||||
@@ -4653,7 +4655,7 @@ parse()
|
||||
if (!Cmd.num_pad || (foo = readchar()) == Cmd.spkeys[NHKF_COUNT]) {
|
||||
long tmpmulti = multi;
|
||||
|
||||
foo = get_count((char *) 0, '\0', LARGEST_INT, &tmpmulti);
|
||||
foo = get_count((char *) 0, '\0', LARGEST_INT, &tmpmulti, FALSE);
|
||||
last_multi = multi = tmpmulti;
|
||||
}
|
||||
#ifdef ALTMETA
|
||||
@@ -4910,7 +4912,13 @@ yn_function(query, resp, def)
|
||||
const char *query, *resp;
|
||||
char def;
|
||||
{
|
||||
char qbuf[QBUFSZ];
|
||||
char res, qbuf[QBUFSZ];
|
||||
#ifdef DUMPLOG
|
||||
extern unsigned saved_pline_index; /* pline.c */
|
||||
unsigned idx = saved_pline_index;
|
||||
/* buffer to hold query+space+formatted_single_char_response */
|
||||
char dumplog_buf[QBUFSZ + 1 + 15]; /* [QBUFSZ+1+7] should suffice */
|
||||
#endif
|
||||
|
||||
iflags.last_msg = PLNMSG_UNKNOWN; /* most recent pline is clobbered */
|
||||
|
||||
@@ -4922,7 +4930,18 @@ char def;
|
||||
Strcpy(&qbuf[QBUFSZ - 1 - 3], "...");
|
||||
query = qbuf;
|
||||
}
|
||||
return (*windowprocs.win_yn_function)(query, resp, def);
|
||||
res = (*windowprocs.win_yn_function)(query, resp, def);
|
||||
#ifdef DUMPLOG
|
||||
if (idx == saved_pline_index) {
|
||||
/* when idx is still the same as saved_pline_index, the interface
|
||||
didn't put the prompt into saved_plines[]; we put a simplified
|
||||
version in there now (without response choices or default) */
|
||||
Sprintf(dumplog_buf, "%s ", query);
|
||||
(void) key2txt((uchar) res, eos(dumplog_buf));
|
||||
dumplogmsg(dumplog_buf);
|
||||
}
|
||||
#endif
|
||||
return res;
|
||||
}
|
||||
|
||||
/* for paranoid_confirm:quit,die,attack prompting */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.6 do_name.c $NHDT-Date: 1452669022 2016/01/13 07:10:22 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.90 $ */
|
||||
/* NetHack 3.6 do_name.c $NHDT-Date: 1489494376 2017/03/14 12:26:16 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.116 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
|
||||
@@ -1011,10 +1011,12 @@ do_mname()
|
||||
(void) christen_monst(mtmp, buf);
|
||||
}
|
||||
|
||||
STATIC_VAR int via_naming = 0;
|
||||
|
||||
/*
|
||||
* This routine changes the address of obj. Be careful not to call it
|
||||
* when there might be pointers around in unknown places. For now: only
|
||||
* when obj is in the inventory.
|
||||
* This routine used to change the address of 'obj' so be unsafe if not
|
||||
* used with extreme care. Applying a name to an object no longer
|
||||
* allocates a replacement object, so that old risk is gone.
|
||||
*/
|
||||
STATIC_OVL
|
||||
void
|
||||
@@ -1079,7 +1081,9 @@ register struct obj *obj;
|
||||
display_nhwindow(WIN_MESSAGE, FALSE);
|
||||
You("engrave: \"%s\".", buf);
|
||||
}
|
||||
++via_naming; /* This ought to be an argument rather than a static... */
|
||||
obj = oname(obj, buf);
|
||||
--via_naming; /* ...but oname() is used in a lot of places, so defer. */
|
||||
}
|
||||
|
||||
struct obj *
|
||||
@@ -1119,8 +1123,10 @@ const char *name;
|
||||
/* if obj is owned by a shop, increase your bill */
|
||||
if (obj->unpaid)
|
||||
alter_cost(obj, 0L);
|
||||
/* violate illiteracy conduct since successfully wrote arti-name */
|
||||
u.uconduct.literate++;
|
||||
if (via_naming) {
|
||||
/* violate illiteracy conduct since successfully wrote arti-name */
|
||||
u.uconduct.literate++;
|
||||
}
|
||||
}
|
||||
if (carried(obj))
|
||||
update_inventory();
|
||||
|
||||
17
src/invent.c
17
src/invent.c
@@ -166,16 +166,9 @@ const genericptr vptr2;
|
||||
if ((namcmp = strcmpi(nam1, nam2)) != 0)
|
||||
return namcmp;
|
||||
|
||||
/* Sort by BUCX. Map blessed to 4, uncursed to 2, cursed to 1, and
|
||||
unknown to 0. */
|
||||
val1 = obj1->bknown
|
||||
? (obj1->blessed << 2)
|
||||
+ ((!obj1->blessed && !obj1->cursed) << 1) + obj1->cursed
|
||||
: 0;
|
||||
val2 = obj2->bknown
|
||||
? (obj2->blessed << 2)
|
||||
+ ((!obj2->blessed && !obj2->cursed) << 1) + obj2->cursed
|
||||
: 0;
|
||||
/* Sort by BUCX. */
|
||||
val1 = obj1->bknown ? (obj1->blessed ? 3 : !obj1->cursed ? 2 : 1) : 0;
|
||||
val2 = obj2->bknown ? (obj2->blessed ? 3 : !obj2->cursed ? 2 : 1) : 0;
|
||||
if (val1 != val2)
|
||||
return val2 - val1; /* bigger is better */
|
||||
|
||||
@@ -216,7 +209,7 @@ tiebreak:
|
||||
/* They're identical, as far as we're concerned. We want
|
||||
to force a deterministic order, and do so by producing a
|
||||
stable sort: maintain the original order of equal items. */
|
||||
return (sli2->indx - sli1->indx);
|
||||
return (sli1->indx - sli2->indx);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -1313,7 +1306,7 @@ register const char *let, *word;
|
||||
pline("No count allowed with this command.");
|
||||
continue;
|
||||
}
|
||||
ilet = get_count(NULL, ilet, LARGEST_INT, &tmpcnt);
|
||||
ilet = get_count(NULL, ilet, LARGEST_INT, &tmpcnt, TRUE);
|
||||
if (tmpcnt) {
|
||||
cnt = tmpcnt;
|
||||
cntgiven = TRUE;
|
||||
|
||||
42
src/pline.c
42
src/pline.c
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.6 pline.c $NHDT-Date: 1489192905 2017/03/11 00:41:45 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.57 $ */
|
||||
/* NetHack 3.6 pline.c $NHDT-Date: 1490908465 2017/03/30 21:14:25 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.58 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
*/
|
||||
#include "hack.h"
|
||||
|
||||
static boolean no_repeat = FALSE;
|
||||
static unsigned pline_flags = 0;
|
||||
static char prevmsg[BUFSZ];
|
||||
|
||||
static char *FDECL(You_buf, (int));
|
||||
@@ -98,7 +98,8 @@ VA_DECL(const char *, line)
|
||||
{ /* start of vpline() or of nested block in USE_OLDARG's pline() */
|
||||
char pbuf[3 * BUFSZ];
|
||||
int ln;
|
||||
xchar msgtyp;
|
||||
int msgtyp;
|
||||
boolean no_repeat;
|
||||
/* Do NOT use VA_START and VA_END in here... see above */
|
||||
|
||||
if (!line || !*line)
|
||||
@@ -134,18 +135,23 @@ VA_DECL(const char *, line)
|
||||
return;
|
||||
}
|
||||
|
||||
msgtyp = MSGTYP_NORMAL;
|
||||
no_repeat = (pline_flags & PLINE_NOREPEAT) ? TRUE : FALSE;
|
||||
#ifdef DUMPLOG
|
||||
/* We hook here early to have options-agnostic output.
|
||||
* Unfortunately, that means Norep() isn't honored (general issue) and
|
||||
* that short lines aren't combined into one longer one (tty behavior).
|
||||
*/
|
||||
dumplogmsg(line);
|
||||
if ((pline_flags & SUPPRESS_HISTORY) == 0)
|
||||
dumplogmsg(line);
|
||||
#endif
|
||||
if ((pline_flags & OVERRIDE_MSGTYPE) != 0) {
|
||||
msgtyp = msgtype_type(line, no_repeat);
|
||||
if (msgtyp == MSGTYP_NOSHOW
|
||||
|| (msgtyp == MSGTYP_NOREP && !strcmp(line, prevmsg)))
|
||||
return;
|
||||
}
|
||||
|
||||
msgtyp = msgtype_type(line, no_repeat);
|
||||
if (msgtyp == MSGTYP_NOSHOW
|
||||
|| (msgtyp == MSGTYP_NOREP && !strcmp(line, prevmsg)))
|
||||
return;
|
||||
if (vision_full_recalc)
|
||||
vision_recalc(0);
|
||||
if (u.ux)
|
||||
@@ -170,15 +176,31 @@ VA_DECL(const char *, line)
|
||||
#endif
|
||||
}
|
||||
|
||||
/* pline() variant which can override MSGTYPE handling or suppress
|
||||
message history (tty interface uses pline() to issue prompts and
|
||||
they shouldn't be blockable via MSGTYPE=hide) */
|
||||
/*VARARGS2*/
|
||||
void custompline
|
||||
VA_DECL2(unsigned, pflags, const char *, line)
|
||||
{
|
||||
VA_START(line);
|
||||
VA_INIT(line, const char *);
|
||||
pline_flags = pflags;
|
||||
vpline(line, VA_ARGS);
|
||||
pline_flags = 0;
|
||||
VA_END();
|
||||
return;
|
||||
}
|
||||
|
||||
/*VARARGS1*/
|
||||
void Norep
|
||||
VA_DECL(const char *, line)
|
||||
{
|
||||
VA_START(line);
|
||||
VA_INIT(line, const char *);
|
||||
no_repeat = TRUE;
|
||||
pline_flags = PLINE_NOREPEAT;
|
||||
vpline(line, VA_ARGS);
|
||||
no_repeat = FALSE;
|
||||
pline_flags = 0;
|
||||
VA_END();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.6 trap.c $NHDT-Date: 1473665044 2016/09/12 07:24:04 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.274 $ */
|
||||
/* NetHack 3.6 trap.c $NHDT-Date: 1489745987 2017/03/17 10:19:47 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.277 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
|
||||
@@ -4420,6 +4420,8 @@ boolean *noticed; /* set to true iff hero notices the effect; */
|
||||
const char *trapdescr, *which;
|
||||
boolean ishero = (mon == &youmonst);
|
||||
|
||||
if (!mon)
|
||||
return FALSE;
|
||||
if (mon == u.usteed)
|
||||
ishero = TRUE;
|
||||
t = t_at(ishero ? u.ux : mon->mx, ishero ? u.uy : mon->my);
|
||||
@@ -4478,6 +4480,8 @@ boolean *noticed; /* set to true iff hero notices the effect; */
|
||||
unsigned dotrapflags;
|
||||
boolean ishero = (mon == &youmonst), result;
|
||||
|
||||
if (!mon)
|
||||
return FALSE;
|
||||
if (mon == u.usteed)
|
||||
ishero = TRUE;
|
||||
t = t_at(ishero ? u.ux : mon->mx, ishero ? u.uy : mon->my);
|
||||
@@ -4521,6 +4525,8 @@ boolean *noticed; /* set to true iff hero notices the effect; */
|
||||
struct trap *t;
|
||||
boolean ishero = (mon == &youmonst), result;
|
||||
|
||||
if (!mon)
|
||||
return FALSE;
|
||||
if (mon == u.usteed)
|
||||
ishero = TRUE;
|
||||
t = t_at(ishero ? u.ux : mon->mx, ishero ? u.uy : mon->my);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.6 getline.c $NHDT-Date: 1432512813 2015/05/25 00:13:33 $ $NHDT-Branch: master $:$NHDT-Revision: 1.28 $ */
|
||||
/* NetHack 3.6 getline.c $NHDT-Date: 1490908467 2017/03/30 21:14:27 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.31 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#include "func_tab.h"
|
||||
|
||||
char morc = 0; /* tell the outside world what char you chose */
|
||||
STATIC_VAR boolean suppress_history;
|
||||
STATIC_DCL boolean FDECL(ext_cmd_getlin_hook, (char *));
|
||||
|
||||
typedef boolean FDECL((*getlin_hook_proc), (char *));
|
||||
@@ -35,6 +36,7 @@ tty_getlin(query, bufp)
|
||||
const char *query;
|
||||
register char *bufp;
|
||||
{
|
||||
suppress_history = FALSE;
|
||||
hooked_tty_getlin(query, bufp, (getlin_hook_proc) 0);
|
||||
}
|
||||
|
||||
@@ -54,7 +56,7 @@ getlin_hook_proc hook;
|
||||
cw->flags &= ~WIN_STOP;
|
||||
ttyDisplay->toplin = 3; /* special prompt state */
|
||||
ttyDisplay->inread++;
|
||||
pline("%s ", query);
|
||||
custompline(OVERRIDE_MSGTYPE | SUPPRESS_HISTORY, "%s ", query);
|
||||
*obufp = 0;
|
||||
for (;;) {
|
||||
(void) fflush(stdout);
|
||||
@@ -82,6 +84,7 @@ getlin_hook_proc hook;
|
||||
if (c == '\020') { /* ctrl-P */
|
||||
if (iflags.prevmsg_window != 's') {
|
||||
int sav = ttyDisplay->inread;
|
||||
|
||||
ttyDisplay->inread = 0;
|
||||
(void) tty_doprev_message();
|
||||
ttyDisplay->inread = sav;
|
||||
@@ -136,9 +139,9 @@ getlin_hook_proc hook;
|
||||
#endif /* not NEWAUTOCOMP */
|
||||
break;
|
||||
} else if (' ' <= (unsigned char) c && c != '\177'
|
||||
/* avoid isprint() - some people don't have it
|
||||
' ' is not always a printing char */
|
||||
&& (bufp - obufp < BUFSZ - 1 && bufp - obufp < COLNO)) {
|
||||
/* avoid isprint() - some people don't have it
|
||||
' ' is not always a printing char */
|
||||
#ifdef NEWAUTOCOMP
|
||||
char *i = eos(bufp);
|
||||
|
||||
@@ -166,7 +169,7 @@ getlin_hook_proc hook;
|
||||
#endif /* NEWAUTOCOMP */
|
||||
}
|
||||
} else if (c == kill_char || c == '\177') { /* Robert Viduya */
|
||||
/* this test last - @ might be the kill_char */
|
||||
/* this test last - @ might be the kill_char */
|
||||
#ifndef NEWAUTOCOMP
|
||||
while (bufp != obufp) {
|
||||
bufp--;
|
||||
@@ -185,6 +188,17 @@ getlin_hook_proc hook;
|
||||
ttyDisplay->toplin = 2; /* nonempty, no --More-- required */
|
||||
ttyDisplay->inread--;
|
||||
clear_nhwindow(WIN_MESSAGE); /* clean up after ourselves */
|
||||
|
||||
if (suppress_history) {
|
||||
/* prevent next message from pushing current query+answer into
|
||||
tty message history */
|
||||
*toplines = '\0';
|
||||
#ifdef DUMPLOG
|
||||
} else {
|
||||
/* needed because we've bypassed pline() */
|
||||
dumplogmsg(toplines);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
@@ -267,9 +281,14 @@ tty_get_ext_cmd()
|
||||
|
||||
if (iflags.extmenu)
|
||||
return extcmd_via_menu();
|
||||
/* maybe a runtime option? */
|
||||
/* hooked_tty_getlin("#", buf, flags.cmd_comp ? ext_cmd_getlin_hook :
|
||||
* (getlin_hook_proc) 0); */
|
||||
|
||||
suppress_history = TRUE;
|
||||
/* maybe a runtime option?
|
||||
* hooked_tty_getlin("#", buf,
|
||||
* (flags.cmd_comp && !in_doagain)
|
||||
* ? ext_cmd_getlin_hook
|
||||
* : (getlin_hook_proc) 0);
|
||||
*/
|
||||
hooked_tty_getlin("#", buf, in_doagain ? (getlin_hook_proc) 0
|
||||
: ext_cmd_getlin_hook);
|
||||
(void) mungspaces(buf);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.6 topl.c $NHDT-Date: 1463787697 2016/05/20 23:41:37 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.33 $ */
|
||||
/* NetHack 3.6 topl.c $NHDT-Date: 1490908468 2017/03/30 21:14:28 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.36 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
|
||||
@@ -331,6 +331,7 @@ register int n;
|
||||
|
||||
extern char erase_char; /* from xxxtty.c; don't need kill_char */
|
||||
|
||||
/* returns a single keystroke; also sets 'yn_number' */
|
||||
char
|
||||
tty_yn_function(query, resp, def)
|
||||
const char *query, *resp;
|
||||
@@ -354,6 +355,7 @@ char def;
|
||||
boolean doprev = 0;
|
||||
char prompt[BUFSZ];
|
||||
|
||||
yn_number = 0L;
|
||||
if (ttyDisplay->toplin == 1 && !(cw->flags & WIN_STOP))
|
||||
more();
|
||||
cw->flags &= ~WIN_STOP;
|
||||
@@ -383,11 +385,12 @@ char def;
|
||||
/* not pline("%s ", prompt);
|
||||
trailing space is wanted here in case of reprompt */
|
||||
Strcat(prompt, " ");
|
||||
pline("%s", prompt);
|
||||
custompline(OVERRIDE_MSGTYPE | SUPPRESS_HISTORY, "%s", prompt);
|
||||
} else {
|
||||
/* no restriction on allowed response, so always preserve case */
|
||||
/* preserve_case = TRUE; -- moot since we're jumping to the end */
|
||||
pline("%s ", query);
|
||||
Sprintf(prompt, "%s ", query);
|
||||
custompline(OVERRIDE_MSGTYPE | SUPPRESS_HISTORY, "%s", prompt);
|
||||
q = readchar();
|
||||
goto clean_up;
|
||||
}
|
||||
@@ -444,6 +447,7 @@ char def;
|
||||
char z, digit_string[2];
|
||||
int n_len = 0;
|
||||
long value = 0;
|
||||
|
||||
addtopl("#"), n_len++;
|
||||
digit_string[1] = '\0';
|
||||
if (q != '#') {
|
||||
@@ -491,11 +495,16 @@ char def;
|
||||
}
|
||||
} while (!q);
|
||||
|
||||
if (q != '#') {
|
||||
Sprintf(rtmp, "%c", q);
|
||||
addtopl(rtmp);
|
||||
}
|
||||
clean_up:
|
||||
clean_up:
|
||||
if (yn_number)
|
||||
Sprintf(rtmp, "#%ld", yn_number);
|
||||
else
|
||||
(void) key2txt(q, rtmp);
|
||||
/* addtopl(rtmp); -- rewrite toplines instead */
|
||||
Sprintf(toplines, "%s%s", prompt, rtmp);
|
||||
#ifdef DUMPLOG
|
||||
dumplogmsg(toplines);
|
||||
#endif
|
||||
ttyDisplay->inread--;
|
||||
ttyDisplay->toplin = 2;
|
||||
if (ttyDisplay->intr)
|
||||
@@ -636,6 +645,9 @@ boolean restoring_msghist;
|
||||
{
|
||||
static boolean initd = FALSE;
|
||||
int idx;
|
||||
#ifdef DUMPLOG
|
||||
extern unsigned saved_pline_index; /* pline.c */
|
||||
#endif
|
||||
|
||||
if (restoring_msghist && !initd) {
|
||||
/* we're restoring history from the previous session, but new
|
||||
@@ -645,18 +657,27 @@ boolean restoring_msghist;
|
||||
restored ones are being put into place */
|
||||
msghistory_snapshot(TRUE);
|
||||
initd = TRUE;
|
||||
#ifdef DUMPLOG
|
||||
/* this suffices; there's no need to scrub saved_pline[] pointers */
|
||||
saved_pline_index = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
if (msg) {
|
||||
/* move most recent message to history, make this become most recent
|
||||
*/
|
||||
/* move most recent message to history, make this become most recent */
|
||||
remember_topl();
|
||||
Strcpy(toplines, msg);
|
||||
#ifdef DUMPLOG
|
||||
dumplogmsg(toplines);
|
||||
#endif
|
||||
} else if (snapshot_mesgs) {
|
||||
/* done putting arbitrary messages in; put the snapshot ones back */
|
||||
for (idx = 0; snapshot_mesgs[idx]; ++idx) {
|
||||
remember_topl();
|
||||
Strcpy(toplines, snapshot_mesgs[idx]);
|
||||
#ifdef DUMPLOG
|
||||
dumplogmsg(toplines);
|
||||
#endif
|
||||
}
|
||||
/* now release the snapshot */
|
||||
free_msghistory_snapshot(TRUE);
|
||||
|
||||
Reference in New Issue
Block a user