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
-/* 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. */
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);
-/* 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. */
#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,
-/* 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. */
*/
#include "hack.h"
-static boolean no_repeat = FALSE;
+static unsigned pline_flags = 0;
static char prevmsg[BUFSZ];
static char *FDECL(You_buf, (int));
{ /* 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)
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)
#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;
}
-/* 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. */
register int c;
struct WinDesc *cw = wins[WIN_MESSAGE];
boolean doprev = 0;
- char tmpbuf[BUFSZ]; /* [QBUFSZ+1] should suffice */
if (ttyDisplay->toplin == 1 && !(cw->flags & WIN_STOP))
more();
cw->flags &= ~WIN_STOP;
ttyDisplay->toplin = 3; /* special prompt state */
ttyDisplay->inread++;
- /*
- * This used to use pline("%s ", query), but that made getline
- * prompts be susceptible to suppression via the MSGTYPE mechanism.
- * Having 'MSGTYPE=hide "# "' was particularly confusing.
- */
- Sprintf(tmpbuf, "%s ", query);
- tty_putstr(WIN_MESSAGE, 0, tmpbuf);
+ custompline(OVERRIDE_MSGTYPE | SUPPRESS_HISTORY, "%s ", query);
*obufp = 0;
for (;;) {
(void) fflush(stdout);
-/* 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. */
/* not pline("%s ", prompt);
trailing space is wanted here in case of reprompt */
Strcat(prompt, " ");
- /* pline("%s", prompt); -- see comment in hooked_tty_getlin() */
- tty_putstr(WIN_MESSAGE, 0, 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); -- see above about tty_getlin() */
Sprintf(prompt, "%s ", query);
- tty_putstr(WIN_MESSAGE, 0, prompt);
+ custompline(OVERRIDE_MSGTYPE | SUPPRESS_HISTORY, "%s", prompt);
q = readchar();
goto clean_up;
}