DEBUG/debugpline() fixup

* Replace variadic debugpline() with fixed argument debugpline0(str),
   debugpline1(fmt,arg), and so on so that C99 support isn't required;
 * showdebug() becomes a function rather than a macro and handles a
   bit more;
 * two debugpline() calls in light.c have been changed to impossible();
 * DEBUGFILES macro (in sys.c) can substitute for SYSCF's DEBUGFILES
   setting in !SYSCF configuration (I hope that's temporary).
This commit is contained in:
PatR
2015-03-15 18:02:26 -07:00
committed by Pasi Kallinen
parent 4c28a96b92
commit 058299aa3a
27 changed files with 243 additions and 181 deletions

View File

@@ -1,4 +1,4 @@
/* NetHack 3.5 extern.h $NHDT-Date: 1425081976 2015/02/28 00:06:16 $ $NHDT-Branch: master $:$NHDT-Revision: 1.390 $ */
/* NetHack 3.5 extern.h $NHDT-Date: 1426465429 2015/03/16 00:23:49 $ $NHDT-Branch: debug $:$NHDT-Revision: 1.406 $ */
/* NetHack 3.5 extern.h $Date: 2013/11/05 00:57:53 $ $Revision: 1.380 $ */
/* Copyright (c) Steve Creps, 1988. */
/* NetHack may be freely redistributed. See license for details. */
@@ -741,6 +741,9 @@ E boolean NDECL(recover_savefile);
#ifdef HOLD_LOCKFILE_OPEN
E void NDECL(really_close);
#endif
#ifdef DEBUG
E boolean FDECL(showdebug, (const char *));
#endif
/* ### fountain.c ### */

View File

@@ -1,4 +1,4 @@
/* NetHack 3.5 hack.h $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */
/* NetHack 3.5 hack.h $NHDT-Date: 1426465431 2015/03/16 00:23:51 $ $NHDT-Branch: debug $:$NHDT-Revision: 1.52 $ */
/* NetHack 3.5 hack.h $Date: 2009/05/06 10:44:46 $ $Revision: 1.49 $ */
/* SCCS Id: @(#)hack.h 3.5 2008/03/19 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
@@ -11,32 +11,22 @@
#include "config.h"
#endif
/* [DEBUG shouldn't be defined unless you know what you're doing...] */
#ifdef DEBUG
/* due to strstr(), mon.c matches makemon.c */
# define showdebug() (sysopt.debugfiles && \
((sysopt.debugfiles[0] == '*') || \
(strstr( __FILE__ , sysopt.debugfiles))))
/* GCC understands this syntax */
# ifdef __GNUC__
/* ... but whines about it anyway without these pragmas. */
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wvariadic-macros"
# define debugpline(args...) \
do { if (showdebug()) pline( args ); } while(0);
# pragma GCC diagnostic pop
# endif
/* and Visual Studio understands this one */
# ifdef _MSC_VER
# define debugpline(...) \
do { if (showdebug()) pline(__VA_ARGS__); } while(0);
# endif
# define ifdebug(stmt) do { if (showdebug(__FILE__)) stmt; } while (0)
/* these don't require compiler support for C99 variadic macros */
# define debugpline0(str) ifdebug(pline(str))
# define debugpline1(fmt,arg) ifdebug(pline(fmt,arg))
# define debugpline2(fmt,a1,a2) ifdebug(pline(fmt,a1,a2))
# define debugpline3(fmt,a1,a2,a3) ifdebug(pline(fmt,a1,a2,a3))
# define debugpline4(fmt,a1,a2,a3,a4) ifdebug(pline(fmt,a1,a2,a3,a4))
#else
# define showdebug() (0)
# define debugpline(...)
#endif
# define debugpline0(str) /*empty*/
# define debugpline1(fmt,arg) /*empty*/
# define debugpline2(fmt,a1,a2) /*empty*/
# define debugpline3(fmt,a1,a2,a3) /*empty*/
# define debugpline4(fmt,a1,a2,a3,a4) /*empty*/
#endif /*DEBUG*/
#define TELL 1
#define NOTELL 0

View File

@@ -1,4 +1,4 @@
/* NetHack 3.5 apply.c $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */
/* NetHack 3.5 apply.c $NHDT-Date: 1426465431 2015/03/16 00:23:51 $ $NHDT-Branch: debug $:$NHDT-Revision: 1.173 $ */
/* NetHack 3.5 apply.c $Date: 2012/05/01 02:22:32 $ $Revision: 1.168 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -1770,7 +1770,7 @@ long timeout;
char monnambuf[BUFSZ], carriedby[BUFSZ];
if (!figurine) {
debugpline("null figurine in fig_transform()");
debugpline0("null figurine in fig_transform()");
return;
}
silent = (timeout != monstermoves); /* happened while away */

View File

@@ -1,4 +1,4 @@
/* NetHack 3.5 attrib.c $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */
/* NetHack 3.5 attrib.c $NHDT-Date: 1426465433 2015/03/16 00:23:53 $ $NHDT-Branch: debug $:$NHDT-Revision: 1.34 $ */
/* NetHack 3.5 attrib.c $Date: 2011/10/01 00:25:55 $ $Revision: 1.30 $ */
/* Copyright 1988, 1989, 1990, 1992, M. Stephenson */
/* NetHack may be freely redistributed. See license for details. */
@@ -347,7 +347,7 @@ exercise(i, inc_or_dec)
int i;
boolean inc_or_dec;
{
debugpline("Exercise:");
debugpline0("Exercise:");
if (i == A_INT || i == A_CHA) return; /* can't exercise these */
/* no physical exercise while polymorphed; the body's temporary */
@@ -364,7 +364,7 @@ boolean inc_or_dec;
* Note: *YES* ACURR is the right one to use.
*/
AEXE(i) += (inc_or_dec) ? (rn2(19) > ACURR(i)) : -rn2(2);
debugpline("%s, %s AEXE = %d",
debugpline3("%s, %s AEXE = %d",
(i == A_STR) ? "Str" : (i == A_WIS) ? "Wis" :
(i == A_DEX) ? "Dex" : "Con",
(inc_or_dec) ? "inc" : "dec", AEXE(i));
@@ -392,7 +392,7 @@ exerper()
(u.uhunger > 50) ? HUNGRY :
(u.uhunger > 0) ? WEAK : FAINTING;
debugpline("exerper: Hunger checks");
debugpline0("exerper: Hunger checks");
switch (hs) {
case SATIATED: exercise(A_DEX, FALSE);
if (Role_if(PM_MONK))
@@ -408,7 +408,7 @@ exerper()
}
/* Encumberance Checks */
debugpline("exerper: Encumber checks");
debugpline0("exerper: Encumber checks");
switch (near_capacity()) {
case MOD_ENCUMBER: exercise(A_STR, TRUE); break;
case HVY_ENCUMBER: exercise(A_STR, TRUE);
@@ -421,7 +421,7 @@ exerper()
/* status checks */
if(!(moves % 5)) {
debugpline("exerper: Status checks");
debugpline0("exerper: Status checks");
if ((HClairvoyant & (INTRINSIC|TIMEOUT)) &&
!BClairvoyant) exercise(A_WIS, TRUE);
if (HRegeneration) exercise(A_STR, TRUE);
@@ -453,10 +453,10 @@ exerchk()
exerper();
if(moves >= context.next_attrib_check)
debugpline("exerchk: ready to test. multi = %d.", multi);
debugpline1("exerchk: ready to test. multi = %d.", multi);
/* Are we ready for a test? */
if(moves >= context.next_attrib_check && !multi) {
debugpline("exerchk: testing.");
debugpline0("exerchk: testing.");
/*
* Law of diminishing returns (Part II):
*
@@ -483,7 +483,7 @@ exerchk()
exercise/abuse gradually wears off without impact then */
if (Upolyd && i != A_WIS) goto nextattrib;
debugpline("exerchk: testing %s (%d).",
debugpline2("exerchk: testing %s (%d).",
(i == A_STR) ? "Str" : (i == A_INT) ? "Int?" :
(i == A_WIS) ? "Wis" : (i == A_DEX) ? "Dex" :
(i == A_CON) ? "Con" : (i == A_CHA) ? "Cha?" : "???",
@@ -497,9 +497,9 @@ exerchk()
if (rn2(AVAL) > ((i != A_WIS) ? (abs(ax) * 2 / 3) : abs(ax)))
goto nextattrib;
debugpline("exerchk: changing %d.", i);
debugpline1("exerchk: changing %d.", i);
if(adjattrib(i, mod_val, -1)) {
debugpline("exerchk: changed %d.", i);
debugpline1("exerchk: changed %d.", i);
/* if you actually changed an attrib - zero accumulation */
AEXE(i) = ax = 0;
/* then print an explanation */
@@ -513,7 +513,8 @@ exerchk()
AEXE(i) = (abs(ax) / 2) * mod_val;
}
context.next_attrib_check += rn1(200,800);
debugpline("exerchk: next check at %ld.", context.next_attrib_check);
debugpline1("exerchk: next check at %ld.",
context.next_attrib_check);
}
}

View File

@@ -1,4 +1,4 @@
/* NetHack 3.5 bones.c $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */
/* NetHack 3.5 bones.c $NHDT-Date: 1426465433 2015/03/16 00:23:53 $ $NHDT-Branch: debug $:$NHDT-Revision: 1.45 $ */
/* NetHack 3.5 bones.c $Date: 2012/02/16 02:40:24 $ $Revision: 1.39 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985,1993. */
/* NetHack may be freely redistributed. See license for details. */
@@ -584,7 +584,7 @@ getbones()
if (has_mname(mtmp)) sanitize_name(MNAME(mtmp));
if (mtmp->mhpmax == DEFUNCT_MONSTER) {
if (wizard)
debugpline("Removing defunct monster %s from bones.",
debugpline1("Removing defunct monster %s from bones.",
mtmp->data->mname);
mongone(mtmp);
} else

View File

@@ -1,4 +1,4 @@
/* NetHack 3.5 dbridge.c $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */
/* NetHack 3.5 dbridge.c $NHDT-Date: 1426465433 2015/03/16 00:23:53 $ $NHDT-Branch: debug $:$NHDT-Revision: 1.23 $ */
/* NetHack 3.5 dbridge.c $Date: 2012/02/01 00:49:16 $ $Revision: 1.21 $ */
/* Copyright (c) 1989 by Jean-Christophe Collet */
/* NetHack may be freely redistributed. See license for details. */
@@ -267,7 +267,7 @@ int x, y;
(occupants[entitycnt].ex == x) &&
(occupants[entitycnt].ey == y))
break;
debugpline("entitycnt = %d", entitycnt);
debugpline1("entitycnt = %d", entitycnt);
#ifdef D_DEBUG
wait_synch();
#endif
@@ -467,7 +467,7 @@ boolean chunks;
int misses;
if (chunks)
debugpline("Do chunks miss?");
debugpline0("Do chunks miss?");
if (automiss(etmp))
return(TRUE);
@@ -487,7 +487,7 @@ boolean chunks;
if (is_db_wall(etmp->ex, etmp->ey))
misses -= 3; /* less airspace */
debugpline("Miss chance = %d (out of 8)", misses);
debugpline1("Miss chance = %d (out of 8)", misses);
return((boolean)((misses >= rnd(8))? TRUE : FALSE));
}
@@ -516,7 +516,8 @@ struct entity *etmp;
if (is_db_wall(etmp->ex, etmp->ey))
tmp -= 2; /* less room to maneuver */
debugpline("%s to jump (%d chances in 10)", E_phrase(etmp, "try"), tmp);
debugpline2("%s to jump (%d chances in 10)",
E_phrase(etmp, "try"), tmp);
return((boolean)((tmp >= rnd(10))? TRUE : FALSE));
}
@@ -550,12 +551,11 @@ struct entity *etmp;
pline_The("portcullis misses %s!",
e_nam(etmp));
else
debugpline("The drawbridge misses %s!",
e_nam(etmp));
debugpline1("The drawbridge misses %s!", e_nam(etmp));
if (e_survives_at(etmp, oldx, oldy))
return;
else {
debugpline("Mon can't survive here");
debugpline0("Mon can't survive here");
if (at_portcullis)
must_jump = TRUE;
else
@@ -574,7 +574,7 @@ struct entity *etmp;
if (at_portcullis) {
if (e_jumps(etmp)) {
relocates = TRUE;
debugpline("Jump succeeds!");
debugpline0("Jump succeeds!");
} else {
if (e_inview)
pline("%s crushed by the falling portcullis!",
@@ -587,7 +587,7 @@ struct entity *etmp;
}
} else { /* tries to jump off bridge to original square */
relocates = !e_jumps(etmp);
debugpline("Jump %s!", (relocates)? "fails" : "succeeds");
debugpline1("Jump %s!", (relocates)? "fails" : "succeeds");
}
}
@@ -597,13 +597,13 @@ struct entity *etmp;
* would be inaccessible (i.e. etmp started on drawbridge square) or
* unnecessary (i.e. etmp started here) in such a situation.
*/
debugpline("Doing relocation.");
debugpline0("Doing relocation.");
newx = oldx;
newy = oldy;
(void)find_drawbridge(&newx, &newy);
if ((newx == oldx) && (newy == oldy))
get_wall_for_db(&newx, &newy);
debugpline("Checking new square for occupancy.");
debugpline0("Checking new square for occupancy.");
if (relocates && (e_at(newx, newy))) {
/*
@@ -614,22 +614,22 @@ struct entity *etmp;
struct entity *other;
other = e_at(newx, newy);
debugpline("New square is occupied by %s", e_nam(other));
debugpline1("New square is occupied by %s", e_nam(other));
if (e_survives_at(other, newx, newy) && automiss(other)) {
relocates = FALSE; /* "other" won't budge */
debugpline("%s suicide.", E_phrase(etmp, "commit"));
debugpline1("%s suicide.", E_phrase(etmp, "commit"));
} else {
debugpline("Handling %s", e_nam(other));
debugpline1("Handling %s", e_nam(other));
while ((e_at(newx, newy) != 0) &&
(e_at(newx, newy) != etmp))
do_entity(other);
debugpline("Checking existence of %s", e_nam(etmp));
debugpline1("Checking existence of %s", e_nam(etmp));
#ifdef D_DEBUG
wait_synch();
#endif
if (e_at(oldx, oldy) != etmp) {
debugpline("%s moved or died in recursion somewhere",
debugpline1("%s moved or died in recursion somewhere",
E_phrase(etmp, "have"));
#ifdef D_DEBUG
wait_synch();
@@ -639,7 +639,7 @@ struct entity *etmp;
}
}
if (relocates && !e_at(newx, newy)) {/* if e_at() entity = worm tail */
debugpline("Moving %s", e_nam(etmp));
debugpline1("Moving %s", e_nam(etmp));
if (!is_u(etmp)) {
remove_monster(etmp->ex, etmp->ey);
place_monster(etmp->emon, newx, newy);
@@ -652,12 +652,12 @@ struct entity *etmp;
etmp->ey = newy;
e_inview = e_canseemon(etmp);
}
debugpline("Final disposition of %s", e_nam(etmp));
debugpline1("Final disposition of %s", e_nam(etmp));
#ifdef D_DEBUG
wait_synch();
#endif
if (is_db_wall(etmp->ex, etmp->ey)) {
debugpline("%s in portcullis chamber", E_phrase(etmp, "are"));
debugpline1("%s in portcullis chamber", E_phrase(etmp, "are"));
#ifdef D_DEBUG
wait_synch();
#endif
@@ -678,9 +678,9 @@ struct entity *etmp;
e_died(etmp, 0, CRUSHING); /* no message */
return;
}
debugpline("%s in here", E_phrase(etmp, "survive"));
debugpline1("%s in here", E_phrase(etmp, "survive"));
} else {
debugpline("%s on drawbridge square", E_phrase(etmp, "are"));
debugpline1("%s on drawbridge square", E_phrase(etmp, "are"));
if (is_pool(etmp->ex, etmp->ey) && !e_inview)
if (!Deaf)
You_hear("a splash.");
@@ -691,7 +691,8 @@ struct entity *etmp;
E_phrase(etmp, "fall"));
return;
}
debugpline("%s cannot survive on the drawbridge square",E_phrase(etmp, NULL));
debugpline1("%s cannot survive on the drawbridge square",
E_phrase(etmp, NULL));
if (is_pool(etmp->ex, etmp->ey) || is_lava(etmp->ex, etmp->ey))
if (e_inview && !is_u(etmp)) {
/* drown() will supply msgs if nec. */
@@ -907,7 +908,7 @@ int x,y;
if (etmp1->edata) {
e_inview = e_canseemon(etmp1);
if (e_missed(etmp1, TRUE)) {
debugpline("%s spared!", E_phrase(etmp1, "are"));
debugpline1("%s spared!", E_phrase(etmp1, "are"));
/* if there is water or lava here, fall in now */
if (is_u(etmp1))
spoteffects(FALSE);
@@ -925,7 +926,7 @@ int x,y;
if (!Deaf && !is_u(etmp1) && !is_pool(x,y))
You_hear("a crushing sound.");
else
debugpline("%s from shrapnel",
debugpline1("%s from shrapnel",
E_phrase(etmp1, "die"));
}
killer.format = KILLED_BY_AN;

View File

@@ -1,4 +1,4 @@
/* NetHack 3.5 dig.c $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */
/* NetHack 3.5 dig.c $NHDT-Date: 1426465434 2015/03/16 00:23:54 $ $NHDT-Branch: debug $:$NHDT-Revision: 1.73 $ */
/* NetHack 3.5 dig.c $Date: 2012/02/16 03:01:37 $ $Revision: 1.67 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -1689,7 +1689,7 @@ bury_an_obj(otmp)
struct obj *otmp2;
boolean under_ice;
debugpline("bury_an_obj: %s", xname(otmp));
debugpline1("bury_an_obj: %s", xname(otmp));
if (otmp == uball) {
unpunish();
u.utrap = rn1(50,20);
@@ -1752,7 +1752,7 @@ int x, y;
struct obj *otmp, *otmp2;
if(level.objects[x][y] != (struct obj *)0)
debugpline("bury_objs: at %d, %d", x, y);
debugpline2("bury_objs: at <%d,%d>", x, y);
for (otmp = level.objects[x][y]; otmp; otmp = otmp2)
otmp2 = bury_an_obj(otmp);
@@ -1769,7 +1769,7 @@ int x, y;
struct obj *otmp, *otmp2, *bball;
coord cc;
debugpline("unearth_objs: at %d, %d", x, y);
debugpline2("unearth_objs: at <%d,%d>", x, y);
cc.x = x; cc.y = y;
bball = buried_ball(&cc);
for (otmp = level.buriedobjlist; otmp; otmp = otmp2) {
@@ -1878,7 +1878,7 @@ void
bury_monst(mtmp)
struct monst *mtmp;
{
debugpline("bury_monst: %s", mon_nam(mtmp));
debugpline1("bury_monst: %s", mon_nam(mtmp));
if(canseemon(mtmp)) {
if(is_flyer(mtmp->data) || is_floater(mtmp->data)) {
pline_The("%s opens up, but %s is not swallowed!",
@@ -1897,7 +1897,7 @@ struct monst *mtmp;
void
bury_you()
{
debugpline("bury_you");
debugpline0("bury_you");
if (!Levitation && !Flying) {
if(u.uswallow)
You_feel("a sensation like falling into a trap!");
@@ -1914,7 +1914,7 @@ bury_you()
void
unearth_you()
{
debugpline("unearth_you");
debugpline0("unearth_you");
u.uburied = FALSE;
under_ground(0);
if(!uamul || uamul->otyp != AMULET_OF_STRANGULATION)
@@ -1925,7 +1925,7 @@ unearth_you()
void
escape_tomb()
{
debugpline("escape_tomb");
debugpline0("escape_tomb");
if ((Teleportation || can_teleport(youmonst.data)) &&
(Teleport_control || rn2(3) < Luck+2)) {
You("attempt a teleport spell.");
@@ -1957,7 +1957,7 @@ bury_obj(otmp)
struct obj *otmp;
{
debugpline("bury_obj");
debugpline0("bury_obj");
if(cansee(otmp->ox, otmp->oy))
pline_The("objects on the %s tumble into a hole!",
surface(otmp->ox, otmp->oy));

View File

@@ -1,4 +1,4 @@
/* NetHack 3.5 dungeon.c $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */
/* NetHack 3.5 dungeon.c $NHDT-Date: 1426465434 2015/03/16 00:23:54 $ $NHDT-Branch: debug $:$NHDT-Revision: 1.39 $ */
/* NetHack 3.5 dungeon.c $Date: 2012/04/14 08:31:05 $ $Revision: 1.34 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -81,7 +81,7 @@ dumpit()
s_level *x;
branch *br;
if (!showdebug()) return;
if (!showdebug(__FILE__)) return;
for(i = 0; i < n_dgns; i++) {
fprintf(stderr, "\n#%d \"%s\" (%s):\n", i,

View File

@@ -1,4 +1,4 @@
/* NetHack 3.5 eat.c $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */
/* NetHack 3.5 eat.c $NHDT-Date: 1426465435 2015/03/16 00:23:55 $ $NHDT-Branch: debug $:$NHDT-Revision: 1.123 $ */
/* NetHack 3.5 eat.c $Date: 2012/02/01 00:49:16 $ $Revision: 1.116 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -284,11 +284,11 @@ recalc_wt()
{
struct obj *piece = context.victual.piece;
debugpline("Old weight = %d", piece->owt);
debugpline("Used time = %d, Req'd time = %d",
context.victual.usedtime, context.victual.reqtime);
debugpline1("Old weight = %d", piece->owt);
debugpline2("Used time = %d, Req'd time = %d",
context.victual.usedtime, context.victual.reqtime);
piece->owt = weight(piece);
debugpline("New weight = %d", piece->owt);
debugpline1("New weight = %d", piece->owt);
}
void
@@ -298,7 +298,7 @@ reset_eat() /* called when eating interrupted by an event */
* the round is spent eating.
*/
if(context.victual.eating && !context.victual.doreset) {
debugpline("reset_eat...");
debugpline0("reset_eat...");
context.victual.doreset = TRUE;
}
return;
@@ -313,7 +313,7 @@ register struct obj *otmp;
(void) splitobj(otmp, otmp->quan - 1L);
else
otmp = splitobj(otmp, 1L);
debugpline("split object,");
debugpline0("split object,");
}
if (!otmp->oeaten) {
@@ -374,7 +374,7 @@ struct obj *old_obj, *new_obj;
STATIC_OVL void
do_reset_eat()
{
debugpline("do_reset_eat...");
debugpline0("do_reset_eat...");
if (context.victual.piece) {
context.victual.o_id = 0;
context.victual.piece = touchfood(context.victual.piece);
@@ -717,39 +717,39 @@ register struct permonst *ptr;
switch (type) {
case FIRE_RES:
res = (ptr->mconveys & MR_FIRE) != 0;
if (res) debugpline("can get fire resistance");
if (res) debugpline0("can get fire resistance");
break;
case SLEEP_RES:
res = (ptr->mconveys & MR_SLEEP) != 0;
if (res) debugpline("can get sleep resistance");
if (res) debugpline0("can get sleep resistance");
break;
case COLD_RES:
res = (ptr->mconveys & MR_COLD) != 0;
if (res) debugpline("can get cold resistance");
if (res) debugpline0("can get cold resistance");
break;
case DISINT_RES:
res = (ptr->mconveys & MR_DISINT) != 0;
if (res) debugpline("can get disintegration resistance");
if (res) debugpline0("can get disintegration resistance");
break;
case SHOCK_RES: /* shock (electricity) resistance */
res = (ptr->mconveys & MR_ELEC) != 0;
if (res) debugpline("can get shock resistance");
if (res) debugpline0("can get shock resistance");
break;
case POISON_RES:
res = (ptr->mconveys & MR_POISON) != 0;
if (res) debugpline("can get poison resistance");
if (res) debugpline0("can get poison resistance");
break;
case TELEPORT:
res = can_teleport(ptr);
if (res) debugpline("can get teleport");
if (res) debugpline0("can get teleport");
break;
case TELEPORT_CONTROL:
res = control_teleport(ptr);
if (res) debugpline("can get teleport control");
if (res) debugpline0("can get teleport control");
break;
case TELEPAT:
res = telepathic(ptr);
if (res) debugpline("can get telepathy");
if (res) debugpline0("can get telepathy");
break;
default:
/* res stays 0 */
@@ -768,7 +768,7 @@ register struct permonst *ptr;
{
register int chance;
debugpline("Attempting to give intrinsic %d", type);
debugpline1("Attempting to give intrinsic %d", type);
/* some intrinsics are easier to get than others */
switch (type) {
case POISON_RES:
@@ -797,7 +797,7 @@ register struct permonst *ptr;
switch (type) {
case FIRE_RES:
debugpline("Trying to give fire resistance");
debugpline0("Trying to give fire resistance");
if(!(HFire_resistance & FROMOUTSIDE)) {
You(Hallucination ? "be chillin'." :
"feel a momentary chill.");
@@ -805,21 +805,21 @@ register struct permonst *ptr;
}
break;
case SLEEP_RES:
debugpline("Trying to give sleep resistance");
debugpline0("Trying to give sleep resistance");
if(!(HSleep_resistance & FROMOUTSIDE)) {
You_feel("wide awake.");
HSleep_resistance |= FROMOUTSIDE;
}
break;
case COLD_RES:
debugpline("Trying to give cold resistance");
debugpline0("Trying to give cold resistance");
if(!(HCold_resistance & FROMOUTSIDE)) {
You_feel("full of hot air.");
HCold_resistance |= FROMOUTSIDE;
}
break;
case DISINT_RES:
debugpline("Trying to give disintegration resistance");
debugpline0("Trying to give disintegration resistance");
if(!(HDisint_resistance & FROMOUTSIDE)) {
You_feel(Hallucination ?
"totally together, man." :
@@ -828,7 +828,7 @@ register struct permonst *ptr;
}
break;
case SHOCK_RES: /* shock (electricity) resistance */
debugpline("Trying to give shock resistance");
debugpline0("Trying to give shock resistance");
if(!(HShock_resistance & FROMOUTSIDE)) {
if (Hallucination)
You_feel("grounded in reality.");
@@ -838,7 +838,7 @@ register struct permonst *ptr;
}
break;
case POISON_RES:
debugpline("Trying to give poison resistance");
debugpline0("Trying to give poison resistance");
if(!(HPoison_resistance & FROMOUTSIDE)) {
You_feel(Poison_resistance ?
"especially healthy." : "healthy.");
@@ -846,7 +846,7 @@ register struct permonst *ptr;
}
break;
case TELEPORT:
debugpline("Trying to give teleport");
debugpline0("Trying to give teleport");
if(!(HTeleportation & FROMOUTSIDE)) {
You_feel(Hallucination ? "diffuse." :
"very jumpy.");
@@ -854,7 +854,7 @@ register struct permonst *ptr;
}
break;
case TELEPORT_CONTROL:
debugpline("Trying to give teleport control");
debugpline0("Trying to give teleport control");
if(!(HTeleport_control & FROMOUTSIDE)) {
You_feel(Hallucination ?
"centered in your personal space." :
@@ -863,7 +863,7 @@ register struct permonst *ptr;
}
break;
case TELEPAT:
debugpline("Trying to give telepathy");
debugpline0("Trying to give telepathy");
if(!(HTelepat & FROMOUTSIDE)) {
You_feel(Hallucination ?
"in touch with the cosmos." :
@@ -874,7 +874,7 @@ register struct permonst *ptr;
}
break;
default:
debugpline("Tried to give an impossible intrinsic");
debugpline0("Tried to give an impossible intrinsic");
break;
}
}
@@ -1005,7 +1005,7 @@ register int pm;
case PM_DISENCHANTER:
/* picks an intrinsic at random and removes it; there's
no feedback if hero already lacks the chosen ability */
debugpline("using attrcurse to strip an intrinsic");
debugpline0("using attrcurse to strip an intrinsic");
attrcurse();
break;
case PM_MIND_FLAYER:
@@ -1045,7 +1045,7 @@ register int pm;
if (conveys_STR) {
count = 1;
tmp = -1; /* use -1 as fake prop index for STR */
debugpline("\"Intrinsic\" strength, %d", tmp);
debugpline1("\"Intrinsic\" strength, %d", tmp);
}
for (i = 1; i <= LAST_PROP; i++) {
if (!intrinsic_possible(i, ptr)) continue;
@@ -1055,7 +1055,7 @@ register int pm;
of keeping the old choice (note that 1 in 1 and
0 in 1 are what we want for the first candidate) */
if (!rn2(count)) {
debugpline("Intrinsic %d replacing %d", i, tmp);
debugpline2("Intrinsic %d replacing %d", i, tmp);
tmp = i;
}
}
@@ -1599,11 +1599,12 @@ start_eating(otmp) /* called as you start to eat */
{
const char *old_nomovemsg, *save_nomovemsg;
debugpline("start_eating: %p (victual = %p)", otmp, context.victual.piece);
debugpline("reqtime = %d", context.victual.reqtime);
debugpline("(original reqtime = %d)", objects[otmp->otyp].oc_delay);
debugpline("nmod = %d", context.victual.nmod);
debugpline("oeaten = %d", otmp->oeaten);
debugpline2("start_eating: %lx (victual = %lx)",
(unsigned long)otmp, (unsigned long)context.victual.piece);
debugpline1("reqtime = %d", context.victual.reqtime);
debugpline1("(original reqtime = %d)", objects[otmp->otyp].oc_delay);
debugpline1("nmod = %d", context.victual.nmod);
debugpline1("oeaten = %d", otmp->oeaten);
context.victual.fullwarn = context.victual.doreset = FALSE;
context.victual.eating = TRUE;
@@ -2443,11 +2444,14 @@ doeat() /* generic "eat" command funtion (see cmd.c) */
if (otmp->otyp == CORPSE) basenutrit = mons[otmp->corpsenm].cnutrit;
else basenutrit = objects[otmp->otyp].oc_nutrition;
debugpline("before rounddiv: context.victual.reqtime == %d", context.victual.reqtime);
debugpline("oeaten == %d, basenutrit == %d", otmp->oeaten, basenutrit);
debugpline1("before rounddiv: context.victual.reqtime == %d",
context.victual.reqtime);
debugpline2("oeaten == %d, basenutrit == %d",
otmp->oeaten, basenutrit);
context.victual.reqtime = (basenutrit == 0 ? 0 :
rounddiv(context.victual.reqtime * (long)otmp->oeaten, basenutrit));
debugpline("after rounddiv: context.victual.reqtime == %d", context.victual.reqtime);
debugpline1("after rounddiv: context.victual.reqtime == %d",
context.victual.reqtime);
/* calculate the modulo value (nutrit. units per round eating)
* note: this isn't exact - you actually lose a little nutrition
* due to this method.
@@ -2549,7 +2553,7 @@ register int num;
{
/* See comments in newuhs() for discussion on force_save_hs */
boolean iseating = (occupation == eatfood) || force_save_hs;
debugpline("lesshungry(%d)", num);
debugpline1("lesshungry(%d)", num);
u.uhunger += num;
if(u.uhunger >= 2000) {
if (!iseating || context.victual.canchoke) {

View File

@@ -1,4 +1,4 @@
/* NetHack 3.5 files.c $NHDT-Date: 1425081976 2015/02/28 00:06:16 $ $NHDT-Branch: master $:$NHDT-Revision: 1.127 $ */
/* NetHack 3.5 files.c $NHDT-Date: 1426465435 2015/03/16 00:23:55 $ $NHDT-Branch: debug $:$NHDT-Revision: 1.133 $ */
/* NetHack 3.5 files.c $Date: 2012/03/10 02:49:08 $ $Revision: 1.124 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -3195,4 +3195,55 @@ int ifd, ofd;
/* ---------- END INTERNAL RECOVER ----------- */
#endif /*SELF_RECOVER*/
#ifdef DEBUG
/* used by debugpline() to decide whether to issue a message
from a partiular source file; caller passes __FILE__ and we check
whether it is in the source file list supplied by SYSCF's DEBUGFILES */
boolean
showdebug(filename)
const char *filename;
{
const char *debugfiles, *p;
if (!filename || !*filename) return FALSE; /* sanity precaution */
debugfiles = sysopt.debugfiles;
/* usual case: sysopt.debugfiles will be empty */
if (!debugfiles || !*debugfiles) return FALSE;
/* strip filename's path if present */
# ifdef UNIX
if ((p = rindex(filename, '/')) != 0) filename = p + 1;
# endif
# ifdef VMS
filename = vms_basename(filename);
/* vms_basename strips off 'type' suffix as well as path and version;
we want to put suffix back (".c" assumed); since it always returns
a pointer to a static buffer, we can safely modify its result */
Strcat((char *)filename, ".c");
# endif
/*
* Wildcard match will only work if there's a single pattern (which
* might be a single file name without any wildcarding) rather than
* a space-separated list.
* [to NOT do: We could step through the space-separated list and
* attempt a wildcard match against each element, but that would be
* overkill for the intended usage.]
*/
if (pmatch(debugfiles, filename))
return TRUE;
/* check whether filename is an element of the list */
if ((p = strstr(debugfiles, filename)) != 0) {
int l = (int)strlen(filename);
if ((p == debugfiles || p[-1] == ' ' || p[-1] == '/')
&& (p[l] == ' ' || p[l] == '\0'))
return TRUE;
}
return FALSE;
}
#endif /*DEBUG*/
/*files.c*/

View File

@@ -1,4 +1,4 @@
/* NetHack 3.5 light.c $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */
/* NetHack 3.5 light.c $NHDT-Date: 1426465436 2015/03/16 00:23:56 $ $NHDT-Branch: debug $:$NHDT-Revision: 1.17 $ */
/* NetHack 3.5 light.c $Date: 2009/05/06 10:46:38 $ $Revision: 1.15 $ */
/* SCCS Id: @(#)light.c 3.5 2009/01/20 */
/* Copyright (c) Dean Luick, 1994 */
@@ -394,13 +394,13 @@ write_ls(fd, ls)
ls->id = zeroany;
ls->id.a_uint = otmp->o_id;
if (find_oid((unsigned)ls->id.a_uint) != otmp)
debugpline("write_ls: can't find obj #%u!", ls->id.a_uint);
impossible("write_ls: can't find obj #%u!", ls->id.a_uint);
} else { /* ls->type == LS_MONSTER */
mtmp = (struct monst *)ls->id.a_monst;
ls->id = zeroany;
ls->id.a_uint = mtmp->m_id;
if (find_mid((unsigned)ls->id.a_uint, FM_EVERYWHERE) != mtmp)
debugpline("write_ls: can't find mon #%u!", ls->id.a_uint);
impossible("write_ls: can't find mon #%u!", ls->id.a_uint);
}
ls->flags |= LSF_NEEDS_FIXUP;
bwrite(fd, (genericptr_t)ls, sizeof(light_source));

View File

@@ -1,4 +1,4 @@
/* NetHack 3.5 makemon.c $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */
/* NetHack 3.5 makemon.c $NHDT-Date: 1426465436 2015/03/16 00:23:56 $ $NHDT-Branch: debug $:$NHDT-Revision: 1.74 $ */
/* NetHack 3.5 makemon.c $Date: 2012/01/29 00:34:33 $ $Revision: 1.69 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -93,7 +93,7 @@ register int x, y, n;
int cnttmp,cntdiv;
cnttmp = cnt;
debugpline("init group call x=%d,y=%d,n=%d,cnt=%d.", x, y, n, cnt);
debugpline4("init group call <%d,%d>, n=%d, cnt=%d.", x, y, n, cnt);
cntdiv = ((u.ulevel < 3) ? 4 : (u.ulevel < 5) ? 2 : 1);
#endif
/* Tuning: cut down on swarming at low character levels [mrs] */
@@ -758,7 +758,7 @@ boolean ghostly;
mvitals[mndx].born++;
if ((int) mvitals[mndx].born >= lim && !(mons[mndx].geno & G_NOGEN) &&
!(mvitals[mndx].mvflags & G_EXTINCT)) {
if (wizard) debugpline("Automatically extinguished %s.",
if (wizard) debugpline1("Automatically extinguished %s.",
makeplural(mons[mndx].mname));
mvitals[mndx].mvflags |= G_EXTINCT;
reset_rndmonst(mndx);
@@ -903,8 +903,8 @@ register int mmflags;
already been genocided, return */
if (mvitals[mndx].mvflags & G_GENOD) return((struct monst *) 0);
if (wizard && (mvitals[mndx].mvflags & G_EXTINCT))
debugpline("Explicitly creating extinct monster %s.",
mons[mndx].mname);
debugpline1("Explicitly creating extinct monster %s.",
mons[mndx].mname);
} else {
/* make a random (common) monster that can survive here.
* (the special levels ask for random monsters at specific
@@ -916,7 +916,7 @@ register int mmflags;
do {
if(!(ptr = rndmonst())) {
debugpline("Warning: no monster.");
debugpline0("Warning: no monster.");
return((struct monst *) 0); /* no more monsters! */
}
fakemon.data = ptr; /* set up for goodpos */
@@ -1252,7 +1252,7 @@ rndmonst()
}
if (mndx == SPECIAL_PM) {
/* evidently they've all been exterminated */
debugpline("rndmonst: no common mons!");
debugpline0("rndmonst: no common mons!");
return (struct permonst *)0;
} /* else `mndx' now ready for use below */
zlevel = level_difficulty();
@@ -1290,7 +1290,8 @@ rndmonst()
if (rndmonst_state.choice_count <= 0) {
/* maybe no common mons left, or all are too weak or too strong */
debugpline("rndmonst: choice_count=%d", rndmonst_state.choice_count);
debugpline1("rndmonst: choice_count=%d",
rndmonst_state.choice_count);
return (struct permonst *)0;
}

View File

@@ -1,4 +1,4 @@
/* NetHack 3.5 mklev.c $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */
/* NetHack 3.5 mklev.c $NHDT-Date: 1426465436 2015/03/16 00:23:56 $ $NHDT-Branch: debug $:$NHDT-Revision: 1.25 $ */
/* NetHack 3.5 mklev.c $Date: 2012/02/15 01:55:33 $ $Revision: 1.20 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -684,7 +684,7 @@ makelevel()
/* make a secret treasure vault, not connected to the rest */
if(do_vault()) {
xchar w,h;
debugpline("trying to make a vault...");
debugpline0("trying to make a vault...");
w = 1;
h = 1;
if (check_room(&vault_x, &w, &vault_y, &h, TRUE)) {
@@ -1560,7 +1560,7 @@ xchar x, y;
*source = u.uz;
insert_branch(br, TRUE);
debugpline("Made knox portal.");
debugpline0("Made knox portal.");
place_branch(br, x, y);
}

View File

@@ -1,4 +1,4 @@
/* NetHack 3.5 mkmaze.c $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */
/* NetHack 3.5 mkmaze.c $NHDT-Date: 1426465437 2015/03/16 00:23:57 $ $NHDT-Branch: debug $:$NHDT-Revision: 1.20 $ */
/* NetHack 3.5 mkmaze.c $Date: 2009/05/06 10:46:56 $ $Revision: 1.18 $ */
/* SCCS Id: @(#)mkmaze.c 3.5 2007/06/18 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
@@ -589,7 +589,7 @@ register const char *s;
if (x_range <= INVPOS_X_MARGIN || y_range <= INVPOS_Y_MARGIN ||
(x_range * y_range) <= (INVPOS_DISTANCE * INVPOS_DISTANCE))
debugpline("inv_pos: maze is too small! (%d x %d)",
debugpline2("inv_pos: maze is too small! (%d x %d)",
x_maze_max, y_maze_max);
inv_pos.x = inv_pos.y = 0; /*{occupied() => invocation_pos()}*/
do {
@@ -877,7 +877,7 @@ register xchar x, y, todnum, todlevel;
impossible("portal on top of portal??");
return;
}
debugpline("mkportal: at (%d,%d), to %s, level %d",
debugpline4("mkportal: at <%d,%d>, to %s, level %d",
x, y, dungeons[todnum].dname, todlevel);
ttmp->dst.dnum = todnum;
ttmp->dst.dlevel = todlevel;

View File

@@ -1,4 +1,4 @@
/* NetHack 3.5 mkobj.c $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */
/* NetHack 3.5 mkobj.c $NHDT-Date: 1426465437 2015/03/16 00:23:57 $ $NHDT-Branch: debug $:$NHDT-Revision: 1.77 $ */
/* NetHack 3.5 mkobj.c $Date: 2012/03/10 02:49:08 $ $Revision: 1.70 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -1521,10 +1521,9 @@ struct obj *otmp;
/* Adjust the age; must be same as obj_timer_checks() for off ice*/
age = monstermoves - otmp->age;
retval += age * (ROT_ICE_ADJUSTMENT-1) / ROT_ICE_ADJUSTMENT;
debugpline("The %s age has ice modifications:otmp->age = %ld, returning %ld.",
s_suffix(doname(otmp)),otmp->age, retval);
debugpline("Effective age of corpse: %ld.",
monstermoves - retval);
debugpline3("The %s age has ice modifications: otmp->age = %ld, returning %ld.",
s_suffix(doname(otmp)), otmp->age, retval);
debugpline1("Effective age of corpse: %ld.", monstermoves - retval);
}
return retval;
}
@@ -1553,7 +1552,8 @@ int force; /* 0 = no force so do checks, <0 = force off, >0 force on */
/* mark the corpse as being on ice */
otmp->on_ice = 1;
debugpline("%s is now on ice at %d,%d.", The(xname(otmp)),x,y);
debugpline3("%s is now on ice at <%d,%d>.",
The(xname(otmp)), x, y);
/* Adjust the time remaining */
tleft *= ROT_ICE_ADJUSTMENT;
restart_timer = TRUE;
@@ -1579,7 +1579,8 @@ int force; /* 0 = no force so do checks, <0 = force off, >0 force on */
long age;
otmp->on_ice = 0;
debugpline("%s is no longer on ice at %d,%d.", The(xname(otmp)),x,y);
debugpline3("%s is no longer on ice at <%d,%d>.",
The(xname(otmp)), x, y);
/* Adjust the remaining time */
tleft /= ROT_ICE_ADJUSTMENT;
restart_timer = TRUE;

View File

@@ -1,4 +1,4 @@
/* NetHack 3.5 mon.c $NHDT-Date: 1425319883 2015/03/02 18:11:23 $ $NHDT-Branch: master $:$NHDT-Revision: 1.137 $ */
/* NetHack 3.5 mon.c $NHDT-Date: 1426465438 2015/03/16 00:23:58 $ $NHDT-Branch: debug $:$NHDT-Revision: 1.139 $ */
/* NetHack 3.5 mon.c $Date: 2012/05/16 02:15:10 $ $Revision: 1.126 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -1260,7 +1260,7 @@ register struct monst *mtmp, *mtmp2;
/* transfer the monster's inventory */
for (otmp = mtmp2->minvent; otmp; otmp = otmp->nobj) {
if (otmp->where != OBJ_MINVENT || otmp->ocarry != mtmp)
debugpline("replmon: minvent inconsistency");
debugpline0("replmon: minvent inconsistency");
otmp->ocarry = mtmp2;
}
mtmp->minvent = 0;

View File

@@ -1,4 +1,4 @@
/* NetHack 3.5 pickup.c $NHDT-Date: 1425081977 2015/02/28 00:06:17 $ $NHDT-Branch: master $:$NHDT-Revision: 1.126 $ */
/* NetHack 3.5 pickup.c $NHDT-Date: 1426465438 2015/03/16 00:23:58 $ $NHDT-Branch: debug $:$NHDT-Revision: 1.130 $ */
/* NetHack 3.5 pickup.c $Date: 2012/02/16 03:01:38 $ $Revision: 1.123 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -897,7 +897,7 @@ int how; /* type of query */
(*pick_list)->item.a_int = curr->oclass;
return 1;
} else {
debugpline("query_category: no single object match");
debugpline0("query_category: no single object match");
}
return 0;
}

View File

@@ -1,4 +1,4 @@
/* NetHack 3.5 questpgr.c $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */
/* NetHack 3.5 questpgr.c $NHDT-Date: 1426465439 2015/03/16 00:23:59 $ $NHDT-Branch: debug $:$NHDT-Revision: 1.18 $ */
/* NetHack 3.5 questpgr.c $Date: 2012/02/02 09:18:14 $ $Revision: 1.14 $ */
/* Copyright 1991, M. Stephenson */
/* NetHack may be freely redistributed. See license for details. */
@@ -47,7 +47,7 @@ dump_qtlist() /* dump the character msg list to check appearance */
{
struct qtmsg *msg;
if (!showdebug()) return;
if (!showdebug(__FILE__)) return;
for (msg = qt_list.chrole; msg->msgnum > 0; msg++) {
pline("msgnum %d: delivery %c",

View File

@@ -1,4 +1,4 @@
/* NetHack 3.5 restore.c $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */
/* NetHack 3.5 restore.c $NHDT-Date: 1426465439 2015/03/16 00:23:59 $ $NHDT-Branch: debug $:$NHDT-Revision: 1.77 $ */
/* NetHack 3.5 restore.c $Date: 2012/02/16 02:40:24 $ $Revision: 1.71 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -1153,7 +1153,7 @@ register int fd;
++msgcount;
}
if (msgcount) putmsghistory((char *)0, TRUE);
debugpline("Read %d messages from savefile.", msgcount);
debugpline1("Read %d messages from savefile.", msgcount);
}
/* Clear all structures for object and monster ID mapping. */

View File

@@ -1,4 +1,4 @@
/* NetHack 3.5 rnd.c $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */
/* NetHack 3.5 rnd.c $NHDT-Date: 1426465440 2015/03/16 00:24:00 $ $NHDT-Branch: debug $:$NHDT-Revision: 1.8 $ */
/* NetHack 3.5 rnd.c $Date: 2009/05/06 10:47:41 $ $Revision: 1.7 $ */
/* SCCS Id: @(#)rnd.c 3.5 2004/08/27 */
/* NetHack may be freely redistributed. See license for details. */
@@ -24,7 +24,7 @@ register int x;
{
#ifdef BETA
if (x <= 0) {
debugpline("rn2(%d) attempted", x);
debugpline1("rn2(%d) attempted", x);
return(0);
}
x = RND(x);
@@ -42,7 +42,7 @@ register int x; /* good luck approaches 0, bad luck approaches (x-1) */
#ifdef BETA
if (x <= 0) {
debugpline("rnl(%d) attempted", x);
debugpline1("rnl(%d) attempted", x);
return(0);
}
#endif
@@ -81,7 +81,7 @@ register int x;
{
#ifdef BETA
if (x <= 0) {
debugpline("rnd(%d) attempted", x);
debugpline1("rnd(%d) attempted", x);
return(1);
}
x = RND(x)+1;
@@ -99,7 +99,7 @@ register int n, x;
#ifdef BETA
if (x < 0 || n < 0 || (x == 0 && n != 0)) {
debugpline("d(%d,%d) attempted", n, x);
debugpline2("d(%d,%d) attempted", n, x);
return(1);
}
#endif

View File

@@ -1,4 +1,4 @@
/* NetHack 3.5 save.c $NHDT-Date: 1425081977 2015/02/28 00:06:17 $ $NHDT-Branch: master $:$NHDT-Revision: 1.59 $ */
/* NetHack 3.5 save.c $NHDT-Date: 1426465440 2015/03/16 00:24:00 $ $NHDT-Branch: debug $:$NHDT-Revision: 1.61 $ */
/* NetHack 3.5 save.c $Date: 2012/02/16 02:40:24 $ $Revision: 1.53 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -1210,7 +1210,7 @@ int fd, mode;
}
bwrite(fd, (genericptr_t) &minusone, sizeof(int));
}
debugpline("Stored %d messages into savefile.", msgcount);
debugpline1("Stored %d messages into savefile.", msgcount);
/* note: we don't attempt to handle release_data() here */
}

View File

@@ -1,4 +1,4 @@
/* NetHack 3.5 shk.c $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */
/* NetHack 3.5 shk.c $NHDT-Date: 1426465441 2015/03/16 00:24:01 $ $NHDT-Branch: debug $:$NHDT-Revision: 1.96 $ */
/* NetHack 3.5 shk.c $Date: 2012/07/03 22:54:49 $ $Revision: 1.91 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -1205,7 +1205,7 @@ dopay()
}
if(!shkp) {
debugpline("dopay: null shkp.");
debugpline0("dopay: null shkp.");
return(0);
}
proceed:

View File

@@ -1,4 +1,4 @@
/* NetHack 3.5 sp_lev.c $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */
/* NetHack 3.5 sp_lev.c $NHDT-Date: 1426465441 2015/03/16 00:24:01 $ $NHDT-Branch: debug $:$NHDT-Revision: 1.25 $ */
/* NetHack 3.5 sp_lev.c $Date: 2011/01/05 01:28:36 $ $Revision: 1.23 $ */
/* Copyright (c) 1989 by Jean-Christophe Collet */
/* NetHack may be freely redistributed. See license for details. */
@@ -324,8 +324,8 @@ chk:
lev = &levl[x][y];
for (; y <= ymax; y++) {
if (lev++->typ) {
if(!vault)
debugpline("strange area [%d,%d] in check_room.",x,y);
if (!vault)
debugpline2("strange area [%d,%d] in check_room.", x, y);
if (!rn2(3)) return FALSE;
if (x < *lowx)
*lowx = x + xlim + 1;
@@ -398,7 +398,7 @@ xchar rtype, rlit;
r1 = rnd_rect(); /* Get a random rectangle */
if (!r1) { /* No more free rectangles ! */
debugpline("No more rects...");
debugpline0("No more rects...");
return FALSE;
}
hx = r1->hx;
@@ -1311,8 +1311,8 @@ schar ftyp, btyp;
if (xx <= 0 || yy <= 0 || tx <= 0 || ty <= 0 ||
xx > COLNO-1 || tx > COLNO-1 ||
yy > ROWNO-1 || ty > ROWNO-1) {
debugpline("dig_corridor: bad coords : (%d,%d) (%d,%d).",
xx,yy,tx,ty);
debugpline4("dig_corridor: bad coords <%d,%d> <%d,%d>.",
xx, yy, tx, ty);
return FALSE;
}
if (tx > xx) dx = 1;

View File

@@ -1,26 +1,34 @@
/* NetHack 3.5 sys.c $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */
/* NetHack 3.5 sys.c $NHDT-Date: 1426465442 2015/03/16 00:24:02 $ $NHDT-Branch: debug $:$NHDT-Revision: 1.16 $ */
/* NetHack 3.5 sys.c $Date: 2012/03/10 02:22:07 $ $Revision: 1.12 $ */
/* Copyright (c) Kenneth Lorber, Kensington, Maryland, 2008. */
/* NetHack may be freely redistributed. See license for details. */
#include "hack.h"
/* for KR1ED config, WIZARD is 0 or 1 and WIZARD_NAME is a string;
for usual config, WIZARD is the string; forcing WIZARD_NAME to match it
eliminates conditional testing for which one to use in string ops */
#ifndef SYSCF
/* !SYSCF configurations need '#define DEBUGFILES "foo.c bar.c"'
to enable debugging feedback for source files foo.c and bar.c;
to activate debugpline(), set an appropriate value and uncomment */
/* # define DEBUGFILES "*" */
#endif
struct sysopt sysopt;
void
sys_early_init(){
sys_early_init()
{
sysopt.support = NULL;
sysopt.recover = NULL;
#ifdef SYSCF
sysopt.wizards = NULL;
#else
sysopt.wizards = WIZARD_NAME;
sysopt.wizards = dupstr(WIZARD_NAME);
#endif
#if defined(SYSCF) || !defined(DEBUGFILES)
sysopt.debugfiles = NULL;
#else
sysopt.debugfiles = dupstr(DEBUGFILES);
#endif
sysopt.shellers = NULL;
sysopt.maxplayers = 0; /* XXX eventually replace MAX_NR_OF_PLAYERS */

View File

@@ -1,4 +1,4 @@
/* NetHack 3.5 teleport.c $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */
/* NetHack 3.5 teleport.c $NHDT-Date: 1426465443 2015/03/16 00:24:03 $ $NHDT-Branch: debug $:$NHDT-Revision: 1.48 $ */
/* NetHack 3.5 teleport.c $Date: 2012/01/04 18:52:36 $ $Revision: 1.45 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -121,7 +121,7 @@ unsigned entflags;
struct monst fakemon; /* dummy monster */
if (!mdat) {
debugpline("enexto() called with mdat==0");
debugpline0("enexto() called with null mdat");
/* default to player's original monster type */
mdat = &mons[u.umonster];
}

View File

@@ -1,4 +1,4 @@
/* NetHack 3.5 zap.c $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */
/* NetHack 3.5 zap.c $NHDT-Date: 1426465444 2015/03/16 00:24:04 $ $NHDT-Branch: debug $:$NHDT-Revision: 1.195 $ */
/* NetHack 3.5 zap.c $Date: 2013/11/05 00:57:56 $ $Revision: 1.183 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -1708,10 +1708,11 @@ struct obj *obj, *otmp;
* as a safeguard against any stray occurrence left in an obj
* struct someplace, although that should never happen.
*/
if (context.bypasses)
if (context.bypasses) {
return 0;
else {
debugpline("%s for a moment.", Tobjnam(obj, "pulsate"));
} else {
debugpline1("%s for a moment.",
Tobjnam(obj, "pulsate"));
obj->bypass = 0;
}
}
@@ -3405,7 +3406,8 @@ struct obj **ootmp; /* to return worn armor for caller to disintegrate */
resist(mon, type < ZT_SPELL(0) ? WAND_CLASS : '\0', 0, NOTELL))
tmp /= 2;
if (tmp < 0) tmp = 0; /* don't allow negative damage */
debugpline("zapped monster hp = %d (= %d - %d)", mon->mhp-tmp,mon->mhp,tmp);
debugpline3("zapped monster hp = %d (= %d - %d)",
mon->mhp-tmp, mon->mhp, tmp);
mon->mhp -= tmp;
return(tmp);
}

View File

@@ -1,4 +1,4 @@
/* NetHack 3.5 wintty.c $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */
/* NetHack 3.5 wintty.c $NHDT-Date: 1426465444 2015/03/16 00:24:04 $ $NHDT-Branch: debug $:$NHDT-Revision: 1.71 $ */
/* NetHack 3.5 wintty.c $Date: 2012/01/22 06:27:09 $ $Revision: 1.66 $ */
/* Copyright (c) David Cohrs, 1991 */
/* NetHack may be freely redistributed. See license for details. */
@@ -1934,7 +1934,7 @@ register int x, y; /* not xchar: perhaps xchar is unsigned and
case NHW_TEXT: s = "[text window]"; break;
case NHW_BASE: s = "[base window]"; break;
}
debugpline("bad curs positioning win %d %s (%d,%d)", window, s, x, y);
debugpline4("bad curs positioning win %d %s (%d,%d)", window, s, x, y);
return;
}
#endif