debugpline() fix
Something which occurred to me when looking at the magic whistle code. It's behavior can vary depending upon whether pline()/You()/&c has been called and that is detected by checking whether pline() has reset iflags.last_msg. Change the debugpline() mechanism to prevent it from interfering with that.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.7 lint.h $NHDT-Date: 1596498539 2020/08/03 23:48:59 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.6 $ */
|
||||
/* NetHack 3.7 lint.h $NHDT-Date: 1655631029 2022/06/19 09:30:29 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.8 $ */
|
||||
/* Copyright (c) 2016 by Robert Patrick Rankin */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
(also caller's responsibility to ensure it isn't actually modified!) */
|
||||
#define nhStr(str) ((char *) str)
|
||||
|
||||
#define nhUse(arg) (void)(arg)
|
||||
#define nhUse(arg) ((void) (arg))
|
||||
|
||||
/*
|
||||
* This stuff isn't related to lint suppression but lives here to
|
||||
@@ -25,10 +25,15 @@
|
||||
#ifdef DEBUG
|
||||
#define showdebug(file) debugcore(file, TRUE)
|
||||
#define explicitdebug(file) debugcore(file, FALSE)
|
||||
/* in case 'stmt' is pline() or something which calls pline(),
|
||||
save and restore previous plnmsg code so that use of debugpline()
|
||||
doesn't change message semantics */
|
||||
#define ifdebug(stmt) \
|
||||
do { \
|
||||
if (showdebug(__FILE__)) { \
|
||||
int save_plnmsg = iflags.last_msg; \
|
||||
stmt; \
|
||||
iflags.last_msg = save_plnmsg; \
|
||||
} \
|
||||
} while (0)
|
||||
#ifdef _MSC_VER
|
||||
@@ -37,7 +42,9 @@
|
||||
#define crtdebug(stmt) \
|
||||
do { \
|
||||
if (showdebug(__FILE__)) { \
|
||||
int save_plnmsg = iflags.last_msg; \
|
||||
stmt; \
|
||||
iflags.last_msg = save_plnmsg; \
|
||||
} \
|
||||
_RPT0(_CRT_WARN, "\n"); \
|
||||
} while (0)
|
||||
|
||||
Reference in New Issue
Block a user