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-17 18:47:31 +02:00
committed by Pasi Kallinen
parent 4c28a96b92
commit 058299aa3a
27 changed files with 243 additions and 181 deletions
+4 -1
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 $ */ /* NetHack 3.5 extern.h $Date: 2013/11/05 00:57:53 $ $Revision: 1.380 $ */
/* Copyright (c) Steve Creps, 1988. */ /* Copyright (c) Steve Creps, 1988. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -741,6 +741,9 @@ E boolean NDECL(recover_savefile);
#ifdef HOLD_LOCKFILE_OPEN #ifdef HOLD_LOCKFILE_OPEN
E void NDECL(really_close); E void NDECL(really_close);
#endif #endif
#ifdef DEBUG
E boolean FDECL(showdebug, (const char *));
#endif
/* ### fountain.c ### */ /* ### fountain.c ### */
+15 -25
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 $ */ /* NetHack 3.5 hack.h $Date: 2009/05/06 10:44:46 $ $Revision: 1.49 $ */
/* SCCS Id: @(#)hack.h 3.5 2008/03/19 */ /* SCCS Id: @(#)hack.h 3.5 2008/03/19 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
@@ -11,32 +11,22 @@
#include "config.h" #include "config.h"
#endif #endif
/* [DEBUG shouldn't be defined unless you know what you're doing...] */
#ifdef DEBUG #ifdef DEBUG
/* due to strstr(), mon.c matches makemon.c */ # define ifdebug(stmt) do { if (showdebug(__FILE__)) stmt; } while (0)
# define showdebug() (sysopt.debugfiles && \ /* these don't require compiler support for C99 variadic macros */
((sysopt.debugfiles[0] == '*') || \ # define debugpline0(str) ifdebug(pline(str))
(strstr( __FILE__ , sysopt.debugfiles)))) # define debugpline1(fmt,arg) ifdebug(pline(fmt,arg))
# define debugpline2(fmt,a1,a2) ifdebug(pline(fmt,a1,a2))
/* GCC understands this syntax */ # define debugpline3(fmt,a1,a2,a3) ifdebug(pline(fmt,a1,a2,a3))
# ifdef __GNUC__ # define debugpline4(fmt,a1,a2,a3,a4) ifdebug(pline(fmt,a1,a2,a3,a4))
/* ... 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
#else #else
# define showdebug() (0) # define debugpline0(str) /*empty*/
# define debugpline(...) # define debugpline1(fmt,arg) /*empty*/
#endif # 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 TELL 1
#define NOTELL 0 #define NOTELL 0
+2 -2
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 $ */ /* NetHack 3.5 apply.c $Date: 2012/05/01 02:22:32 $ $Revision: 1.168 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -1770,7 +1770,7 @@ long timeout;
char monnambuf[BUFSZ], carriedby[BUFSZ]; char monnambuf[BUFSZ], carriedby[BUFSZ];
if (!figurine) { if (!figurine) {
debugpline("null figurine in fig_transform()"); debugpline0("null figurine in fig_transform()");
return; return;
} }
silent = (timeout != monstermoves); /* happened while away */ silent = (timeout != monstermoves); /* happened while away */
+13 -12
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 $ */ /* NetHack 3.5 attrib.c $Date: 2011/10/01 00:25:55 $ $Revision: 1.30 $ */
/* Copyright 1988, 1989, 1990, 1992, M. Stephenson */ /* Copyright 1988, 1989, 1990, 1992, M. Stephenson */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -347,7 +347,7 @@ exercise(i, inc_or_dec)
int i; int i;
boolean inc_or_dec; boolean inc_or_dec;
{ {
debugpline("Exercise:"); debugpline0("Exercise:");
if (i == A_INT || i == A_CHA) return; /* can't exercise these */ if (i == A_INT || i == A_CHA) return; /* can't exercise these */
/* no physical exercise while polymorphed; the body's temporary */ /* 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. * Note: *YES* ACURR is the right one to use.
*/ */
AEXE(i) += (inc_or_dec) ? (rn2(19) > ACURR(i)) : -rn2(2); 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_STR) ? "Str" : (i == A_WIS) ? "Wis" :
(i == A_DEX) ? "Dex" : "Con", (i == A_DEX) ? "Dex" : "Con",
(inc_or_dec) ? "inc" : "dec", AEXE(i)); (inc_or_dec) ? "inc" : "dec", AEXE(i));
@@ -392,7 +392,7 @@ exerper()
(u.uhunger > 50) ? HUNGRY : (u.uhunger > 50) ? HUNGRY :
(u.uhunger > 0) ? WEAK : FAINTING; (u.uhunger > 0) ? WEAK : FAINTING;
debugpline("exerper: Hunger checks"); debugpline0("exerper: Hunger checks");
switch (hs) { switch (hs) {
case SATIATED: exercise(A_DEX, FALSE); case SATIATED: exercise(A_DEX, FALSE);
if (Role_if(PM_MONK)) if (Role_if(PM_MONK))
@@ -408,7 +408,7 @@ exerper()
} }
/* Encumberance Checks */ /* Encumberance Checks */
debugpline("exerper: Encumber checks"); debugpline0("exerper: Encumber checks");
switch (near_capacity()) { switch (near_capacity()) {
case MOD_ENCUMBER: exercise(A_STR, TRUE); break; case MOD_ENCUMBER: exercise(A_STR, TRUE); break;
case HVY_ENCUMBER: exercise(A_STR, TRUE); case HVY_ENCUMBER: exercise(A_STR, TRUE);
@@ -421,7 +421,7 @@ exerper()
/* status checks */ /* status checks */
if(!(moves % 5)) { if(!(moves % 5)) {
debugpline("exerper: Status checks"); debugpline0("exerper: Status checks");
if ((HClairvoyant & (INTRINSIC|TIMEOUT)) && if ((HClairvoyant & (INTRINSIC|TIMEOUT)) &&
!BClairvoyant) exercise(A_WIS, TRUE); !BClairvoyant) exercise(A_WIS, TRUE);
if (HRegeneration) exercise(A_STR, TRUE); if (HRegeneration) exercise(A_STR, TRUE);
@@ -453,10 +453,10 @@ exerchk()
exerper(); exerper();
if(moves >= context.next_attrib_check) 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? */ /* Are we ready for a test? */
if(moves >= context.next_attrib_check && !multi) { if(moves >= context.next_attrib_check && !multi) {
debugpline("exerchk: testing."); debugpline0("exerchk: testing.");
/* /*
* Law of diminishing returns (Part II): * Law of diminishing returns (Part II):
* *
@@ -483,7 +483,7 @@ exerchk()
exercise/abuse gradually wears off without impact then */ exercise/abuse gradually wears off without impact then */
if (Upolyd && i != A_WIS) goto nextattrib; 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_STR) ? "Str" : (i == A_INT) ? "Int?" :
(i == A_WIS) ? "Wis" : (i == A_DEX) ? "Dex" : (i == A_WIS) ? "Wis" : (i == A_DEX) ? "Dex" :
(i == A_CON) ? "Con" : (i == A_CHA) ? "Cha?" : "???", (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))) if (rn2(AVAL) > ((i != A_WIS) ? (abs(ax) * 2 / 3) : abs(ax)))
goto nextattrib; goto nextattrib;
debugpline("exerchk: changing %d.", i); debugpline1("exerchk: changing %d.", i);
if(adjattrib(i, mod_val, -1)) { if(adjattrib(i, mod_val, -1)) {
debugpline("exerchk: changed %d.", i); debugpline1("exerchk: changed %d.", i);
/* if you actually changed an attrib - zero accumulation */ /* if you actually changed an attrib - zero accumulation */
AEXE(i) = ax = 0; AEXE(i) = ax = 0;
/* then print an explanation */ /* then print an explanation */
@@ -513,7 +513,8 @@ exerchk()
AEXE(i) = (abs(ax) / 2) * mod_val; AEXE(i) = (abs(ax) / 2) * mod_val;
} }
context.next_attrib_check += rn1(200,800); 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);
} }
} }
+2 -2
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 $ */ /* NetHack 3.5 bones.c $Date: 2012/02/16 02:40:24 $ $Revision: 1.39 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985,1993. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985,1993. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -584,7 +584,7 @@ getbones()
if (has_mname(mtmp)) sanitize_name(MNAME(mtmp)); if (has_mname(mtmp)) sanitize_name(MNAME(mtmp));
if (mtmp->mhpmax == DEFUNCT_MONSTER) { if (mtmp->mhpmax == DEFUNCT_MONSTER) {
if (wizard) if (wizard)
debugpline("Removing defunct monster %s from bones.", debugpline1("Removing defunct monster %s from bones.",
mtmp->data->mname); mtmp->data->mname);
mongone(mtmp); mongone(mtmp);
} else } else
+26 -25
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 $ */ /* NetHack 3.5 dbridge.c $Date: 2012/02/01 00:49:16 $ $Revision: 1.21 $ */
/* Copyright (c) 1989 by Jean-Christophe Collet */ /* Copyright (c) 1989 by Jean-Christophe Collet */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -267,7 +267,7 @@ int x, y;
(occupants[entitycnt].ex == x) && (occupants[entitycnt].ex == x) &&
(occupants[entitycnt].ey == y)) (occupants[entitycnt].ey == y))
break; break;
debugpline("entitycnt = %d", entitycnt); debugpline1("entitycnt = %d", entitycnt);
#ifdef D_DEBUG #ifdef D_DEBUG
wait_synch(); wait_synch();
#endif #endif
@@ -467,7 +467,7 @@ boolean chunks;
int misses; int misses;
if (chunks) if (chunks)
debugpline("Do chunks miss?"); debugpline0("Do chunks miss?");
if (automiss(etmp)) if (automiss(etmp))
return(TRUE); return(TRUE);
@@ -487,7 +487,7 @@ boolean chunks;
if (is_db_wall(etmp->ex, etmp->ey)) if (is_db_wall(etmp->ex, etmp->ey))
misses -= 3; /* less airspace */ 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)); return((boolean)((misses >= rnd(8))? TRUE : FALSE));
} }
@@ -516,7 +516,8 @@ struct entity *etmp;
if (is_db_wall(etmp->ex, etmp->ey)) if (is_db_wall(etmp->ex, etmp->ey))
tmp -= 2; /* less room to maneuver */ 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)); return((boolean)((tmp >= rnd(10))? TRUE : FALSE));
} }
@@ -550,12 +551,11 @@ struct entity *etmp;
pline_The("portcullis misses %s!", pline_The("portcullis misses %s!",
e_nam(etmp)); e_nam(etmp));
else else
debugpline("The drawbridge misses %s!", debugpline1("The drawbridge misses %s!", e_nam(etmp));
e_nam(etmp));
if (e_survives_at(etmp, oldx, oldy)) if (e_survives_at(etmp, oldx, oldy))
return; return;
else { else {
debugpline("Mon can't survive here"); debugpline0("Mon can't survive here");
if (at_portcullis) if (at_portcullis)
must_jump = TRUE; must_jump = TRUE;
else else
@@ -574,7 +574,7 @@ struct entity *etmp;
if (at_portcullis) { if (at_portcullis) {
if (e_jumps(etmp)) { if (e_jumps(etmp)) {
relocates = TRUE; relocates = TRUE;
debugpline("Jump succeeds!"); debugpline0("Jump succeeds!");
} else { } else {
if (e_inview) if (e_inview)
pline("%s crushed by the falling portcullis!", pline("%s crushed by the falling portcullis!",
@@ -587,7 +587,7 @@ struct entity *etmp;
} }
} else { /* tries to jump off bridge to original square */ } else { /* tries to jump off bridge to original square */
relocates = !e_jumps(etmp); 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 * would be inaccessible (i.e. etmp started on drawbridge square) or
* unnecessary (i.e. etmp started here) in such a situation. * unnecessary (i.e. etmp started here) in such a situation.
*/ */
debugpline("Doing relocation."); debugpline0("Doing relocation.");
newx = oldx; newx = oldx;
newy = oldy; newy = oldy;
(void)find_drawbridge(&newx, &newy); (void)find_drawbridge(&newx, &newy);
if ((newx == oldx) && (newy == oldy)) if ((newx == oldx) && (newy == oldy))
get_wall_for_db(&newx, &newy); get_wall_for_db(&newx, &newy);
debugpline("Checking new square for occupancy."); debugpline0("Checking new square for occupancy.");
if (relocates && (e_at(newx, newy))) { if (relocates && (e_at(newx, newy))) {
/* /*
@@ -614,22 +614,22 @@ struct entity *etmp;
struct entity *other; struct entity *other;
other = e_at(newx, newy); 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)) { if (e_survives_at(other, newx, newy) && automiss(other)) {
relocates = FALSE; /* "other" won't budge */ relocates = FALSE; /* "other" won't budge */
debugpline("%s suicide.", E_phrase(etmp, "commit")); debugpline1("%s suicide.", E_phrase(etmp, "commit"));
} else { } else {
debugpline("Handling %s", e_nam(other)); debugpline1("Handling %s", e_nam(other));
while ((e_at(newx, newy) != 0) && while ((e_at(newx, newy) != 0) &&
(e_at(newx, newy) != etmp)) (e_at(newx, newy) != etmp))
do_entity(other); do_entity(other);
debugpline("Checking existence of %s", e_nam(etmp)); debugpline1("Checking existence of %s", e_nam(etmp));
#ifdef D_DEBUG #ifdef D_DEBUG
wait_synch(); wait_synch();
#endif #endif
if (e_at(oldx, oldy) != etmp) { 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")); E_phrase(etmp, "have"));
#ifdef D_DEBUG #ifdef D_DEBUG
wait_synch(); wait_synch();
@@ -639,7 +639,7 @@ struct entity *etmp;
} }
} }
if (relocates && !e_at(newx, newy)) {/* if e_at() entity = worm tail */ 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)) { if (!is_u(etmp)) {
remove_monster(etmp->ex, etmp->ey); remove_monster(etmp->ex, etmp->ey);
place_monster(etmp->emon, newx, newy); place_monster(etmp->emon, newx, newy);
@@ -652,12 +652,12 @@ struct entity *etmp;
etmp->ey = newy; etmp->ey = newy;
e_inview = e_canseemon(etmp); e_inview = e_canseemon(etmp);
} }
debugpline("Final disposition of %s", e_nam(etmp)); debugpline1("Final disposition of %s", e_nam(etmp));
#ifdef D_DEBUG #ifdef D_DEBUG
wait_synch(); wait_synch();
#endif #endif
if (is_db_wall(etmp->ex, etmp->ey)) { 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 #ifdef D_DEBUG
wait_synch(); wait_synch();
#endif #endif
@@ -678,9 +678,9 @@ struct entity *etmp;
e_died(etmp, 0, CRUSHING); /* no message */ e_died(etmp, 0, CRUSHING); /* no message */
return; return;
} }
debugpline("%s in here", E_phrase(etmp, "survive")); debugpline1("%s in here", E_phrase(etmp, "survive"));
} else { } 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 (is_pool(etmp->ex, etmp->ey) && !e_inview)
if (!Deaf) if (!Deaf)
You_hear("a splash."); You_hear("a splash.");
@@ -691,7 +691,8 @@ struct entity *etmp;
E_phrase(etmp, "fall")); E_phrase(etmp, "fall"));
return; 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 (is_pool(etmp->ex, etmp->ey) || is_lava(etmp->ex, etmp->ey))
if (e_inview && !is_u(etmp)) { if (e_inview && !is_u(etmp)) {
/* drown() will supply msgs if nec. */ /* drown() will supply msgs if nec. */
@@ -907,7 +908,7 @@ int x,y;
if (etmp1->edata) { if (etmp1->edata) {
e_inview = e_canseemon(etmp1); e_inview = e_canseemon(etmp1);
if (e_missed(etmp1, TRUE)) { 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 there is water or lava here, fall in now */
if (is_u(etmp1)) if (is_u(etmp1))
spoteffects(FALSE); spoteffects(FALSE);
@@ -925,7 +926,7 @@ int x,y;
if (!Deaf && !is_u(etmp1) && !is_pool(x,y)) if (!Deaf && !is_u(etmp1) && !is_pool(x,y))
You_hear("a crushing sound."); You_hear("a crushing sound.");
else else
debugpline("%s from shrapnel", debugpline1("%s from shrapnel",
E_phrase(etmp1, "die")); E_phrase(etmp1, "die"));
} }
killer.format = KILLED_BY_AN; killer.format = KILLED_BY_AN;
+9 -9
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 $ */ /* NetHack 3.5 dig.c $Date: 2012/02/16 03:01:37 $ $Revision: 1.67 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -1689,7 +1689,7 @@ bury_an_obj(otmp)
struct obj *otmp2; struct obj *otmp2;
boolean under_ice; boolean under_ice;
debugpline("bury_an_obj: %s", xname(otmp)); debugpline1("bury_an_obj: %s", xname(otmp));
if (otmp == uball) { if (otmp == uball) {
unpunish(); unpunish();
u.utrap = rn1(50,20); u.utrap = rn1(50,20);
@@ -1752,7 +1752,7 @@ int x, y;
struct obj *otmp, *otmp2; struct obj *otmp, *otmp2;
if(level.objects[x][y] != (struct obj *)0) 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) for (otmp = level.objects[x][y]; otmp; otmp = otmp2)
otmp2 = bury_an_obj(otmp); otmp2 = bury_an_obj(otmp);
@@ -1769,7 +1769,7 @@ int x, y;
struct obj *otmp, *otmp2, *bball; struct obj *otmp, *otmp2, *bball;
coord cc; coord cc;
debugpline("unearth_objs: at %d, %d", x, y); debugpline2("unearth_objs: at <%d,%d>", x, y);
cc.x = x; cc.y = y; cc.x = x; cc.y = y;
bball = buried_ball(&cc); bball = buried_ball(&cc);
for (otmp = level.buriedobjlist; otmp; otmp = otmp2) { for (otmp = level.buriedobjlist; otmp; otmp = otmp2) {
@@ -1878,7 +1878,7 @@ void
bury_monst(mtmp) bury_monst(mtmp)
struct monst *mtmp; struct monst *mtmp;
{ {
debugpline("bury_monst: %s", mon_nam(mtmp)); debugpline1("bury_monst: %s", mon_nam(mtmp));
if(canseemon(mtmp)) { if(canseemon(mtmp)) {
if(is_flyer(mtmp->data) || is_floater(mtmp->data)) { if(is_flyer(mtmp->data) || is_floater(mtmp->data)) {
pline_The("%s opens up, but %s is not swallowed!", pline_The("%s opens up, but %s is not swallowed!",
@@ -1897,7 +1897,7 @@ struct monst *mtmp;
void void
bury_you() bury_you()
{ {
debugpline("bury_you"); debugpline0("bury_you");
if (!Levitation && !Flying) { if (!Levitation && !Flying) {
if(u.uswallow) if(u.uswallow)
You_feel("a sensation like falling into a trap!"); You_feel("a sensation like falling into a trap!");
@@ -1914,7 +1914,7 @@ bury_you()
void void
unearth_you() unearth_you()
{ {
debugpline("unearth_you"); debugpline0("unearth_you");
u.uburied = FALSE; u.uburied = FALSE;
under_ground(0); under_ground(0);
if(!uamul || uamul->otyp != AMULET_OF_STRANGULATION) if(!uamul || uamul->otyp != AMULET_OF_STRANGULATION)
@@ -1925,7 +1925,7 @@ unearth_you()
void void
escape_tomb() escape_tomb()
{ {
debugpline("escape_tomb"); debugpline0("escape_tomb");
if ((Teleportation || can_teleport(youmonst.data)) && if ((Teleportation || can_teleport(youmonst.data)) &&
(Teleport_control || rn2(3) < Luck+2)) { (Teleport_control || rn2(3) < Luck+2)) {
You("attempt a teleport spell."); You("attempt a teleport spell.");
@@ -1957,7 +1957,7 @@ bury_obj(otmp)
struct obj *otmp; struct obj *otmp;
{ {
debugpline("bury_obj"); debugpline0("bury_obj");
if(cansee(otmp->ox, otmp->oy)) if(cansee(otmp->ox, otmp->oy))
pline_The("objects on the %s tumble into a hole!", pline_The("objects on the %s tumble into a hole!",
surface(otmp->ox, otmp->oy)); surface(otmp->ox, otmp->oy));
+2 -2
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 $ */ /* NetHack 3.5 dungeon.c $Date: 2012/04/14 08:31:05 $ $Revision: 1.34 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -81,7 +81,7 @@ dumpit()
s_level *x; s_level *x;
branch *br; branch *br;
if (!showdebug()) return; if (!showdebug(__FILE__)) return;
for(i = 0; i < n_dgns; i++) { for(i = 0; i < n_dgns; i++) {
fprintf(stderr, "\n#%d \"%s\" (%s):\n", i, fprintf(stderr, "\n#%d \"%s\" (%s):\n", i,
+44 -40
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 $ */ /* NetHack 3.5 eat.c $Date: 2012/02/01 00:49:16 $ $Revision: 1.116 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -284,11 +284,11 @@ recalc_wt()
{ {
struct obj *piece = context.victual.piece; struct obj *piece = context.victual.piece;
debugpline("Old weight = %d", piece->owt); debugpline1("Old weight = %d", piece->owt);
debugpline("Used time = %d, Req'd time = %d", debugpline2("Used time = %d, Req'd time = %d",
context.victual.usedtime, context.victual.reqtime); context.victual.usedtime, context.victual.reqtime);
piece->owt = weight(piece); piece->owt = weight(piece);
debugpline("New weight = %d", piece->owt); debugpline1("New weight = %d", piece->owt);
} }
void void
@@ -298,7 +298,7 @@ reset_eat() /* called when eating interrupted by an event */
* the round is spent eating. * the round is spent eating.
*/ */
if(context.victual.eating && !context.victual.doreset) { if(context.victual.eating && !context.victual.doreset) {
debugpline("reset_eat..."); debugpline0("reset_eat...");
context.victual.doreset = TRUE; context.victual.doreset = TRUE;
} }
return; return;
@@ -313,7 +313,7 @@ register struct obj *otmp;
(void) splitobj(otmp, otmp->quan - 1L); (void) splitobj(otmp, otmp->quan - 1L);
else else
otmp = splitobj(otmp, 1L); otmp = splitobj(otmp, 1L);
debugpline("split object,"); debugpline0("split object,");
} }
if (!otmp->oeaten) { if (!otmp->oeaten) {
@@ -374,7 +374,7 @@ struct obj *old_obj, *new_obj;
STATIC_OVL void STATIC_OVL void
do_reset_eat() do_reset_eat()
{ {
debugpline("do_reset_eat..."); debugpline0("do_reset_eat...");
if (context.victual.piece) { if (context.victual.piece) {
context.victual.o_id = 0; context.victual.o_id = 0;
context.victual.piece = touchfood(context.victual.piece); context.victual.piece = touchfood(context.victual.piece);
@@ -717,39 +717,39 @@ register struct permonst *ptr;
switch (type) { switch (type) {
case FIRE_RES: case FIRE_RES:
res = (ptr->mconveys & MR_FIRE) != 0; res = (ptr->mconveys & MR_FIRE) != 0;
if (res) debugpline("can get fire resistance"); if (res) debugpline0("can get fire resistance");
break; break;
case SLEEP_RES: case SLEEP_RES:
res = (ptr->mconveys & MR_SLEEP) != 0; res = (ptr->mconveys & MR_SLEEP) != 0;
if (res) debugpline("can get sleep resistance"); if (res) debugpline0("can get sleep resistance");
break; break;
case COLD_RES: case COLD_RES:
res = (ptr->mconveys & MR_COLD) != 0; res = (ptr->mconveys & MR_COLD) != 0;
if (res) debugpline("can get cold resistance"); if (res) debugpline0("can get cold resistance");
break; break;
case DISINT_RES: case DISINT_RES:
res = (ptr->mconveys & MR_DISINT) != 0; res = (ptr->mconveys & MR_DISINT) != 0;
if (res) debugpline("can get disintegration resistance"); if (res) debugpline0("can get disintegration resistance");
break; break;
case SHOCK_RES: /* shock (electricity) resistance */ case SHOCK_RES: /* shock (electricity) resistance */
res = (ptr->mconveys & MR_ELEC) != 0; res = (ptr->mconveys & MR_ELEC) != 0;
if (res) debugpline("can get shock resistance"); if (res) debugpline0("can get shock resistance");
break; break;
case POISON_RES: case POISON_RES:
res = (ptr->mconveys & MR_POISON) != 0; res = (ptr->mconveys & MR_POISON) != 0;
if (res) debugpline("can get poison resistance"); if (res) debugpline0("can get poison resistance");
break; break;
case TELEPORT: case TELEPORT:
res = can_teleport(ptr); res = can_teleport(ptr);
if (res) debugpline("can get teleport"); if (res) debugpline0("can get teleport");
break; break;
case TELEPORT_CONTROL: case TELEPORT_CONTROL:
res = control_teleport(ptr); res = control_teleport(ptr);
if (res) debugpline("can get teleport control"); if (res) debugpline0("can get teleport control");
break; break;
case TELEPAT: case TELEPAT:
res = telepathic(ptr); res = telepathic(ptr);
if (res) debugpline("can get telepathy"); if (res) debugpline0("can get telepathy");
break; break;
default: default:
/* res stays 0 */ /* res stays 0 */
@@ -768,7 +768,7 @@ register struct permonst *ptr;
{ {
register int chance; 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 */ /* some intrinsics are easier to get than others */
switch (type) { switch (type) {
case POISON_RES: case POISON_RES:
@@ -797,7 +797,7 @@ register struct permonst *ptr;
switch (type) { switch (type) {
case FIRE_RES: case FIRE_RES:
debugpline("Trying to give fire resistance"); debugpline0("Trying to give fire resistance");
if(!(HFire_resistance & FROMOUTSIDE)) { if(!(HFire_resistance & FROMOUTSIDE)) {
You(Hallucination ? "be chillin'." : You(Hallucination ? "be chillin'." :
"feel a momentary chill."); "feel a momentary chill.");
@@ -805,21 +805,21 @@ register struct permonst *ptr;
} }
break; break;
case SLEEP_RES: case SLEEP_RES:
debugpline("Trying to give sleep resistance"); debugpline0("Trying to give sleep resistance");
if(!(HSleep_resistance & FROMOUTSIDE)) { if(!(HSleep_resistance & FROMOUTSIDE)) {
You_feel("wide awake."); You_feel("wide awake.");
HSleep_resistance |= FROMOUTSIDE; HSleep_resistance |= FROMOUTSIDE;
} }
break; break;
case COLD_RES: case COLD_RES:
debugpline("Trying to give cold resistance"); debugpline0("Trying to give cold resistance");
if(!(HCold_resistance & FROMOUTSIDE)) { if(!(HCold_resistance & FROMOUTSIDE)) {
You_feel("full of hot air."); You_feel("full of hot air.");
HCold_resistance |= FROMOUTSIDE; HCold_resistance |= FROMOUTSIDE;
} }
break; break;
case DISINT_RES: case DISINT_RES:
debugpline("Trying to give disintegration resistance"); debugpline0("Trying to give disintegration resistance");
if(!(HDisint_resistance & FROMOUTSIDE)) { if(!(HDisint_resistance & FROMOUTSIDE)) {
You_feel(Hallucination ? You_feel(Hallucination ?
"totally together, man." : "totally together, man." :
@@ -828,7 +828,7 @@ register struct permonst *ptr;
} }
break; break;
case SHOCK_RES: /* shock (electricity) resistance */ case SHOCK_RES: /* shock (electricity) resistance */
debugpline("Trying to give shock resistance"); debugpline0("Trying to give shock resistance");
if(!(HShock_resistance & FROMOUTSIDE)) { if(!(HShock_resistance & FROMOUTSIDE)) {
if (Hallucination) if (Hallucination)
You_feel("grounded in reality."); You_feel("grounded in reality.");
@@ -838,7 +838,7 @@ register struct permonst *ptr;
} }
break; break;
case POISON_RES: case POISON_RES:
debugpline("Trying to give poison resistance"); debugpline0("Trying to give poison resistance");
if(!(HPoison_resistance & FROMOUTSIDE)) { if(!(HPoison_resistance & FROMOUTSIDE)) {
You_feel(Poison_resistance ? You_feel(Poison_resistance ?
"especially healthy." : "healthy."); "especially healthy." : "healthy.");
@@ -846,7 +846,7 @@ register struct permonst *ptr;
} }
break; break;
case TELEPORT: case TELEPORT:
debugpline("Trying to give teleport"); debugpline0("Trying to give teleport");
if(!(HTeleportation & FROMOUTSIDE)) { if(!(HTeleportation & FROMOUTSIDE)) {
You_feel(Hallucination ? "diffuse." : You_feel(Hallucination ? "diffuse." :
"very jumpy."); "very jumpy.");
@@ -854,7 +854,7 @@ register struct permonst *ptr;
} }
break; break;
case TELEPORT_CONTROL: case TELEPORT_CONTROL:
debugpline("Trying to give teleport control"); debugpline0("Trying to give teleport control");
if(!(HTeleport_control & FROMOUTSIDE)) { if(!(HTeleport_control & FROMOUTSIDE)) {
You_feel(Hallucination ? You_feel(Hallucination ?
"centered in your personal space." : "centered in your personal space." :
@@ -863,7 +863,7 @@ register struct permonst *ptr;
} }
break; break;
case TELEPAT: case TELEPAT:
debugpline("Trying to give telepathy"); debugpline0("Trying to give telepathy");
if(!(HTelepat & FROMOUTSIDE)) { if(!(HTelepat & FROMOUTSIDE)) {
You_feel(Hallucination ? You_feel(Hallucination ?
"in touch with the cosmos." : "in touch with the cosmos." :
@@ -874,7 +874,7 @@ register struct permonst *ptr;
} }
break; break;
default: default:
debugpline("Tried to give an impossible intrinsic"); debugpline0("Tried to give an impossible intrinsic");
break; break;
} }
} }
@@ -1005,7 +1005,7 @@ register int pm;
case PM_DISENCHANTER: case PM_DISENCHANTER:
/* picks an intrinsic at random and removes it; there's /* picks an intrinsic at random and removes it; there's
no feedback if hero already lacks the chosen ability */ no feedback if hero already lacks the chosen ability */
debugpline("using attrcurse to strip an intrinsic"); debugpline0("using attrcurse to strip an intrinsic");
attrcurse(); attrcurse();
break; break;
case PM_MIND_FLAYER: case PM_MIND_FLAYER:
@@ -1045,7 +1045,7 @@ register int pm;
if (conveys_STR) { if (conveys_STR) {
count = 1; count = 1;
tmp = -1; /* use -1 as fake prop index for STR */ 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++) { for (i = 1; i <= LAST_PROP; i++) {
if (!intrinsic_possible(i, ptr)) continue; if (!intrinsic_possible(i, ptr)) continue;
@@ -1055,7 +1055,7 @@ register int pm;
of keeping the old choice (note that 1 in 1 and of keeping the old choice (note that 1 in 1 and
0 in 1 are what we want for the first candidate) */ 0 in 1 are what we want for the first candidate) */
if (!rn2(count)) { if (!rn2(count)) {
debugpline("Intrinsic %d replacing %d", i, tmp); debugpline2("Intrinsic %d replacing %d", i, tmp);
tmp = i; tmp = i;
} }
} }
@@ -1599,11 +1599,12 @@ start_eating(otmp) /* called as you start to eat */
{ {
const char *old_nomovemsg, *save_nomovemsg; const char *old_nomovemsg, *save_nomovemsg;
debugpline("start_eating: %p (victual = %p)", otmp, context.victual.piece); debugpline2("start_eating: %lx (victual = %lx)",
debugpline("reqtime = %d", context.victual.reqtime); (unsigned long)otmp, (unsigned long)context.victual.piece);
debugpline("(original reqtime = %d)", objects[otmp->otyp].oc_delay); debugpline1("reqtime = %d", context.victual.reqtime);
debugpline("nmod = %d", context.victual.nmod); debugpline1("(original reqtime = %d)", objects[otmp->otyp].oc_delay);
debugpline("oeaten = %d", otmp->oeaten); debugpline1("nmod = %d", context.victual.nmod);
debugpline1("oeaten = %d", otmp->oeaten);
context.victual.fullwarn = context.victual.doreset = FALSE; context.victual.fullwarn = context.victual.doreset = FALSE;
context.victual.eating = TRUE; 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; if (otmp->otyp == CORPSE) basenutrit = mons[otmp->corpsenm].cnutrit;
else basenutrit = objects[otmp->otyp].oc_nutrition; else basenutrit = objects[otmp->otyp].oc_nutrition;
debugpline("before rounddiv: context.victual.reqtime == %d", context.victual.reqtime); debugpline1("before rounddiv: context.victual.reqtime == %d",
debugpline("oeaten == %d, basenutrit == %d", otmp->oeaten, basenutrit); context.victual.reqtime);
debugpline2("oeaten == %d, basenutrit == %d",
otmp->oeaten, basenutrit);
context.victual.reqtime = (basenutrit == 0 ? 0 : context.victual.reqtime = (basenutrit == 0 ? 0 :
rounddiv(context.victual.reqtime * (long)otmp->oeaten, basenutrit)); 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) /* calculate the modulo value (nutrit. units per round eating)
* note: this isn't exact - you actually lose a little nutrition * note: this isn't exact - you actually lose a little nutrition
* due to this method. * due to this method.
@@ -2549,7 +2553,7 @@ register int num;
{ {
/* See comments in newuhs() for discussion on force_save_hs */ /* See comments in newuhs() for discussion on force_save_hs */
boolean iseating = (occupation == eatfood) || force_save_hs; boolean iseating = (occupation == eatfood) || force_save_hs;
debugpline("lesshungry(%d)", num); debugpline1("lesshungry(%d)", num);
u.uhunger += num; u.uhunger += num;
if(u.uhunger >= 2000) { if(u.uhunger >= 2000) {
if (!iseating || context.victual.canchoke) { if (!iseating || context.victual.canchoke) {
+52 -1
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 $ */ /* NetHack 3.5 files.c $Date: 2012/03/10 02:49:08 $ $Revision: 1.124 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -3195,4 +3195,55 @@ int ifd, ofd;
/* ---------- END INTERNAL RECOVER ----------- */ /* ---------- END INTERNAL RECOVER ----------- */
#endif /*SELF_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*/ /*files.c*/
+3 -3
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 $ */ /* NetHack 3.5 light.c $Date: 2009/05/06 10:46:38 $ $Revision: 1.15 $ */
/* SCCS Id: @(#)light.c 3.5 2009/01/20 */ /* SCCS Id: @(#)light.c 3.5 2009/01/20 */
/* Copyright (c) Dean Luick, 1994 */ /* Copyright (c) Dean Luick, 1994 */
@@ -394,13 +394,13 @@ write_ls(fd, ls)
ls->id = zeroany; ls->id = zeroany;
ls->id.a_uint = otmp->o_id; ls->id.a_uint = otmp->o_id;
if (find_oid((unsigned)ls->id.a_uint) != otmp) 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 */ } else { /* ls->type == LS_MONSTER */
mtmp = (struct monst *)ls->id.a_monst; mtmp = (struct monst *)ls->id.a_monst;
ls->id = zeroany; ls->id = zeroany;
ls->id.a_uint = mtmp->m_id; ls->id.a_uint = mtmp->m_id;
if (find_mid((unsigned)ls->id.a_uint, FM_EVERYWHERE) != mtmp) 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; ls->flags |= LSF_NEEDS_FIXUP;
bwrite(fd, (genericptr_t)ls, sizeof(light_source)); bwrite(fd, (genericptr_t)ls, sizeof(light_source));
+9 -8
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 $ */ /* NetHack 3.5 makemon.c $Date: 2012/01/29 00:34:33 $ $Revision: 1.69 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -93,7 +93,7 @@ register int x, y, n;
int cnttmp,cntdiv; int cnttmp,cntdiv;
cnttmp = cnt; 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); cntdiv = ((u.ulevel < 3) ? 4 : (u.ulevel < 5) ? 2 : 1);
#endif #endif
/* Tuning: cut down on swarming at low character levels [mrs] */ /* Tuning: cut down on swarming at low character levels [mrs] */
@@ -758,7 +758,7 @@ boolean ghostly;
mvitals[mndx].born++; mvitals[mndx].born++;
if ((int) mvitals[mndx].born >= lim && !(mons[mndx].geno & G_NOGEN) && if ((int) mvitals[mndx].born >= lim && !(mons[mndx].geno & G_NOGEN) &&
!(mvitals[mndx].mvflags & G_EXTINCT)) { !(mvitals[mndx].mvflags & G_EXTINCT)) {
if (wizard) debugpline("Automatically extinguished %s.", if (wizard) debugpline1("Automatically extinguished %s.",
makeplural(mons[mndx].mname)); makeplural(mons[mndx].mname));
mvitals[mndx].mvflags |= G_EXTINCT; mvitals[mndx].mvflags |= G_EXTINCT;
reset_rndmonst(mndx); reset_rndmonst(mndx);
@@ -903,8 +903,8 @@ register int mmflags;
already been genocided, return */ already been genocided, return */
if (mvitals[mndx].mvflags & G_GENOD) return((struct monst *) 0); if (mvitals[mndx].mvflags & G_GENOD) return((struct monst *) 0);
if (wizard && (mvitals[mndx].mvflags & G_EXTINCT)) if (wizard && (mvitals[mndx].mvflags & G_EXTINCT))
debugpline("Explicitly creating extinct monster %s.", debugpline1("Explicitly creating extinct monster %s.",
mons[mndx].mname); mons[mndx].mname);
} else { } else {
/* make a random (common) monster that can survive here. /* make a random (common) monster that can survive here.
* (the special levels ask for random monsters at specific * (the special levels ask for random monsters at specific
@@ -916,7 +916,7 @@ register int mmflags;
do { do {
if(!(ptr = rndmonst())) { if(!(ptr = rndmonst())) {
debugpline("Warning: no monster."); debugpline0("Warning: no monster.");
return((struct monst *) 0); /* no more monsters! */ return((struct monst *) 0); /* no more monsters! */
} }
fakemon.data = ptr; /* set up for goodpos */ fakemon.data = ptr; /* set up for goodpos */
@@ -1252,7 +1252,7 @@ rndmonst()
} }
if (mndx == SPECIAL_PM) { if (mndx == SPECIAL_PM) {
/* evidently they've all been exterminated */ /* evidently they've all been exterminated */
debugpline("rndmonst: no common mons!"); debugpline0("rndmonst: no common mons!");
return (struct permonst *)0; return (struct permonst *)0;
} /* else `mndx' now ready for use below */ } /* else `mndx' now ready for use below */
zlevel = level_difficulty(); zlevel = level_difficulty();
@@ -1290,7 +1290,8 @@ rndmonst()
if (rndmonst_state.choice_count <= 0) { if (rndmonst_state.choice_count <= 0) {
/* maybe no common mons left, or all are too weak or too strong */ /* 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; return (struct permonst *)0;
} }
+3 -3
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 $ */ /* NetHack 3.5 mklev.c $Date: 2012/02/15 01:55:33 $ $Revision: 1.20 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -684,7 +684,7 @@ makelevel()
/* make a secret treasure vault, not connected to the rest */ /* make a secret treasure vault, not connected to the rest */
if(do_vault()) { if(do_vault()) {
xchar w,h; xchar w,h;
debugpline("trying to make a vault..."); debugpline0("trying to make a vault...");
w = 1; w = 1;
h = 1; h = 1;
if (check_room(&vault_x, &w, &vault_y, &h, TRUE)) { if (check_room(&vault_x, &w, &vault_y, &h, TRUE)) {
@@ -1560,7 +1560,7 @@ xchar x, y;
*source = u.uz; *source = u.uz;
insert_branch(br, TRUE); insert_branch(br, TRUE);
debugpline("Made knox portal."); debugpline0("Made knox portal.");
place_branch(br, x, y); place_branch(br, x, y);
} }
+3 -3
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 $ */ /* NetHack 3.5 mkmaze.c $Date: 2009/05/06 10:46:56 $ $Revision: 1.18 $ */
/* SCCS Id: @(#)mkmaze.c 3.5 2007/06/18 */ /* SCCS Id: @(#)mkmaze.c 3.5 2007/06/18 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* 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 || if (x_range <= INVPOS_X_MARGIN || y_range <= INVPOS_Y_MARGIN ||
(x_range * y_range) <= (INVPOS_DISTANCE * INVPOS_DISTANCE)) (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); x_maze_max, y_maze_max);
inv_pos.x = inv_pos.y = 0; /*{occupied() => invocation_pos()}*/ inv_pos.x = inv_pos.y = 0; /*{occupied() => invocation_pos()}*/
do { do {
@@ -877,7 +877,7 @@ register xchar x, y, todnum, todlevel;
impossible("portal on top of portal??"); impossible("portal on top of portal??");
return; 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); x, y, dungeons[todnum].dname, todlevel);
ttmp->dst.dnum = todnum; ttmp->dst.dnum = todnum;
ttmp->dst.dlevel = todlevel; ttmp->dst.dlevel = todlevel;
+8 -7
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 $ */ /* NetHack 3.5 mkobj.c $Date: 2012/03/10 02:49:08 $ $Revision: 1.70 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */ /* 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*/ /* Adjust the age; must be same as obj_timer_checks() for off ice*/
age = monstermoves - otmp->age; age = monstermoves - otmp->age;
retval += age * (ROT_ICE_ADJUSTMENT-1) / ROT_ICE_ADJUSTMENT; retval += age * (ROT_ICE_ADJUSTMENT-1) / ROT_ICE_ADJUSTMENT;
debugpline("The %s age has ice modifications:otmp->age = %ld, returning %ld.", debugpline3("The %s age has ice modifications: otmp->age = %ld, returning %ld.",
s_suffix(doname(otmp)),otmp->age, retval); s_suffix(doname(otmp)), otmp->age, retval);
debugpline("Effective age of corpse: %ld.", debugpline1("Effective age of corpse: %ld.", monstermoves - retval);
monstermoves - retval);
} }
return 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 */ /* mark the corpse as being on ice */
otmp->on_ice = 1; 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 */ /* Adjust the time remaining */
tleft *= ROT_ICE_ADJUSTMENT; tleft *= ROT_ICE_ADJUSTMENT;
restart_timer = TRUE; restart_timer = TRUE;
@@ -1579,7 +1579,8 @@ int force; /* 0 = no force so do checks, <0 = force off, >0 force on */
long age; long age;
otmp->on_ice = 0; 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 */ /* Adjust the remaining time */
tleft /= ROT_ICE_ADJUSTMENT; tleft /= ROT_ICE_ADJUSTMENT;
restart_timer = TRUE; restart_timer = TRUE;
+2 -2
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 $ */ /* NetHack 3.5 mon.c $Date: 2012/05/16 02:15:10 $ $Revision: 1.126 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -1260,7 +1260,7 @@ register struct monst *mtmp, *mtmp2;
/* transfer the monster's inventory */ /* transfer the monster's inventory */
for (otmp = mtmp2->minvent; otmp; otmp = otmp->nobj) { for (otmp = mtmp2->minvent; otmp; otmp = otmp->nobj) {
if (otmp->where != OBJ_MINVENT || otmp->ocarry != mtmp) if (otmp->where != OBJ_MINVENT || otmp->ocarry != mtmp)
debugpline("replmon: minvent inconsistency"); debugpline0("replmon: minvent inconsistency");
otmp->ocarry = mtmp2; otmp->ocarry = mtmp2;
} }
mtmp->minvent = 0; mtmp->minvent = 0;
+2 -2
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 $ */ /* NetHack 3.5 pickup.c $Date: 2012/02/16 03:01:38 $ $Revision: 1.123 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */ /* 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; (*pick_list)->item.a_int = curr->oclass;
return 1; return 1;
} else { } else {
debugpline("query_category: no single object match"); debugpline0("query_category: no single object match");
} }
return 0; return 0;
} }
+2 -2
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 $ */ /* NetHack 3.5 questpgr.c $Date: 2012/02/02 09:18:14 $ $Revision: 1.14 $ */
/* Copyright 1991, M. Stephenson */ /* Copyright 1991, M. Stephenson */
/* NetHack may be freely redistributed. See license for details. */ /* 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; struct qtmsg *msg;
if (!showdebug()) return; if (!showdebug(__FILE__)) return;
for (msg = qt_list.chrole; msg->msgnum > 0; msg++) { for (msg = qt_list.chrole; msg->msgnum > 0; msg++) {
pline("msgnum %d: delivery %c", pline("msgnum %d: delivery %c",
+2 -2
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 $ */ /* NetHack 3.5 restore.c $Date: 2012/02/16 02:40:24 $ $Revision: 1.71 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -1153,7 +1153,7 @@ register int fd;
++msgcount; ++msgcount;
} }
if (msgcount) putmsghistory((char *)0, TRUE); 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. */ /* Clear all structures for object and monster ID mapping. */
+5 -5
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 $ */ /* NetHack 3.5 rnd.c $Date: 2009/05/06 10:47:41 $ $Revision: 1.7 $ */
/* SCCS Id: @(#)rnd.c 3.5 2004/08/27 */ /* SCCS Id: @(#)rnd.c 3.5 2004/08/27 */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -24,7 +24,7 @@ register int x;
{ {
#ifdef BETA #ifdef BETA
if (x <= 0) { if (x <= 0) {
debugpline("rn2(%d) attempted", x); debugpline1("rn2(%d) attempted", x);
return(0); return(0);
} }
x = RND(x); x = RND(x);
@@ -42,7 +42,7 @@ register int x; /* good luck approaches 0, bad luck approaches (x-1) */
#ifdef BETA #ifdef BETA
if (x <= 0) { if (x <= 0) {
debugpline("rnl(%d) attempted", x); debugpline1("rnl(%d) attempted", x);
return(0); return(0);
} }
#endif #endif
@@ -81,7 +81,7 @@ register int x;
{ {
#ifdef BETA #ifdef BETA
if (x <= 0) { if (x <= 0) {
debugpline("rnd(%d) attempted", x); debugpline1("rnd(%d) attempted", x);
return(1); return(1);
} }
x = RND(x)+1; x = RND(x)+1;
@@ -99,7 +99,7 @@ register int n, x;
#ifdef BETA #ifdef BETA
if (x < 0 || n < 0 || (x == 0 && n != 0)) { 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); return(1);
} }
#endif #endif
+2 -2
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 $ */ /* NetHack 3.5 save.c $Date: 2012/02/16 02:40:24 $ $Revision: 1.53 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -1210,7 +1210,7 @@ int fd, mode;
} }
bwrite(fd, (genericptr_t) &minusone, sizeof(int)); 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 */ /* note: we don't attempt to handle release_data() here */
} }
+2 -2
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 $ */ /* NetHack 3.5 shk.c $Date: 2012/07/03 22:54:49 $ $Revision: 1.91 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -1205,7 +1205,7 @@ dopay()
} }
if(!shkp) { if(!shkp) {
debugpline("dopay: null shkp."); debugpline0("dopay: null shkp.");
return(0); return(0);
} }
proceed: proceed:
+6 -6
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 $ */ /* NetHack 3.5 sp_lev.c $Date: 2011/01/05 01:28:36 $ $Revision: 1.23 $ */
/* Copyright (c) 1989 by Jean-Christophe Collet */ /* Copyright (c) 1989 by Jean-Christophe Collet */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -324,8 +324,8 @@ chk:
lev = &levl[x][y]; lev = &levl[x][y];
for (; y <= ymax; y++) { for (; y <= ymax; y++) {
if (lev++->typ) { if (lev++->typ) {
if(!vault) if (!vault)
debugpline("strange area [%d,%d] in check_room.",x,y); debugpline2("strange area [%d,%d] in check_room.", x, y);
if (!rn2(3)) return FALSE; if (!rn2(3)) return FALSE;
if (x < *lowx) if (x < *lowx)
*lowx = x + xlim + 1; *lowx = x + xlim + 1;
@@ -398,7 +398,7 @@ xchar rtype, rlit;
r1 = rnd_rect(); /* Get a random rectangle */ r1 = rnd_rect(); /* Get a random rectangle */
if (!r1) { /* No more free rectangles ! */ if (!r1) { /* No more free rectangles ! */
debugpline("No more rects..."); debugpline0("No more rects...");
return FALSE; return FALSE;
} }
hx = r1->hx; hx = r1->hx;
@@ -1311,8 +1311,8 @@ schar ftyp, btyp;
if (xx <= 0 || yy <= 0 || tx <= 0 || ty <= 0 || if (xx <= 0 || yy <= 0 || tx <= 0 || ty <= 0 ||
xx > COLNO-1 || tx > COLNO-1 || xx > COLNO-1 || tx > COLNO-1 ||
yy > ROWNO-1 || ty > ROWNO-1) { yy > ROWNO-1 || ty > ROWNO-1) {
debugpline("dig_corridor: bad coords : (%d,%d) (%d,%d).", debugpline4("dig_corridor: bad coords <%d,%d> <%d,%d>.",
xx,yy,tx,ty); xx, yy, tx, ty);
return FALSE; return FALSE;
} }
if (tx > xx) dx = 1; if (tx > xx) dx = 1;
+14 -6
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 $ */ /* NetHack 3.5 sys.c $Date: 2012/03/10 02:22:07 $ $Revision: 1.12 $ */
/* Copyright (c) Kenneth Lorber, Kensington, Maryland, 2008. */ /* Copyright (c) Kenneth Lorber, Kensington, Maryland, 2008. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
#include "hack.h" #include "hack.h"
/* for KR1ED config, WIZARD is 0 or 1 and WIZARD_NAME is a string; #ifndef SYSCF
for usual config, WIZARD is the string; forcing WIZARD_NAME to match it /* !SYSCF configurations need '#define DEBUGFILES "foo.c bar.c"'
eliminates conditional testing for which one to use in string ops */ 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; struct sysopt sysopt;
void void
sys_early_init(){ sys_early_init()
{
sysopt.support = NULL; sysopt.support = NULL;
sysopt.recover = NULL; sysopt.recover = NULL;
#ifdef SYSCF #ifdef SYSCF
sysopt.wizards = NULL; sysopt.wizards = NULL;
#else #else
sysopt.wizards = WIZARD_NAME; sysopt.wizards = dupstr(WIZARD_NAME);
#endif #endif
#if defined(SYSCF) || !defined(DEBUGFILES)
sysopt.debugfiles = NULL; sysopt.debugfiles = NULL;
#else
sysopt.debugfiles = dupstr(DEBUGFILES);
#endif
sysopt.shellers = NULL; sysopt.shellers = NULL;
sysopt.maxplayers = 0; /* XXX eventually replace MAX_NR_OF_PLAYERS */ sysopt.maxplayers = 0; /* XXX eventually replace MAX_NR_OF_PLAYERS */
+2 -2
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 $ */ /* NetHack 3.5 teleport.c $Date: 2012/01/04 18:52:36 $ $Revision: 1.45 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -121,7 +121,7 @@ unsigned entflags;
struct monst fakemon; /* dummy monster */ struct monst fakemon; /* dummy monster */
if (!mdat) { if (!mdat) {
debugpline("enexto() called with mdat==0"); debugpline0("enexto() called with null mdat");
/* default to player's original monster type */ /* default to player's original monster type */
mdat = &mons[u.umonster]; mdat = &mons[u.umonster];
} }
+7 -5
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 $ */ /* NetHack 3.5 zap.c $Date: 2013/11/05 00:57:56 $ $Revision: 1.183 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */ /* 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 * as a safeguard against any stray occurrence left in an obj
* struct someplace, although that should never happen. * struct someplace, although that should never happen.
*/ */
if (context.bypasses) if (context.bypasses) {
return 0; return 0;
else { } else {
debugpline("%s for a moment.", Tobjnam(obj, "pulsate")); debugpline1("%s for a moment.",
Tobjnam(obj, "pulsate"));
obj->bypass = 0; 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)) resist(mon, type < ZT_SPELL(0) ? WAND_CLASS : '\0', 0, NOTELL))
tmp /= 2; tmp /= 2;
if (tmp < 0) tmp = 0; /* don't allow negative damage */ 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; mon->mhp -= tmp;
return(tmp); return(tmp);
} }
+2 -2
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 $ */ /* NetHack 3.5 wintty.c $Date: 2012/01/22 06:27:09 $ $Revision: 1.66 $ */
/* Copyright (c) David Cohrs, 1991 */ /* Copyright (c) David Cohrs, 1991 */
/* NetHack may be freely redistributed. See license for details. */ /* 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_TEXT: s = "[text window]"; break;
case NHW_BASE: s = "[base 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; return;
} }
#endif #endif