Apply paxed's DEBUG patch to remove DEBUG/D_DEBUG.

Move debugging output into couple preprocessor defines, which
    are no-op without DEBUG.  To show debugging output from a
    certain source files, use sysconf:

    DEBUGFILES=dungeon.c questpgr.c

    Also fix couple debug lines which did not compile.

This also includes fixes due to Derek Ray to depugpline to work better
on other platforms.
This commit is contained in:
Pasi Kallinen
2015-02-09 20:56:44 +02:00
parent 05f7a63728
commit 099a1b7b32
32 changed files with 136 additions and 340 deletions

View File

@@ -1773,9 +1773,7 @@ long timeout;
char monnambuf[BUFSZ], carriedby[BUFSZ];
if (!figurine) {
#ifdef DEBUG
pline("null figurine in fig_transform()");
#endif
debugpline("null figurine in fig_transform()");
return;
}
silent = (timeout != monstermoves); /* happened while away */

View File

@@ -8,8 +8,6 @@
#include "hack.h"
#include <ctype.h>
/* #define DEBUG */ /* uncomment for debugging info */
/* part of the output on gain or loss of attribute */
static
const char * const plusattr[] = {
@@ -349,9 +347,7 @@ exercise(i, inc_or_dec)
int i;
boolean inc_or_dec;
{
#ifdef DEBUG
pline("Exercise:");
#endif
debugpline("Exercise:");
if (i == A_INT || i == A_CHA) return; /* can't exercise these */
/* no physical exercise while polymorphed; the body's temporary */
@@ -368,12 +364,10 @@ boolean inc_or_dec;
* Note: *YES* ACURR is the right one to use.
*/
AEXE(i) += (inc_or_dec) ? (rn2(19) > ACURR(i)) : -rn2(2);
#ifdef DEBUG
pline("%s, %s AEXE = %d",
debugpline("%s, %s AEXE = %d",
(i == A_STR) ? "Str" : (i == A_WIS) ? "Wis" :
(i == A_DEX) ? "Dex" : "Con",
(inc_or_dec) ? "inc" : "dec", AEXE(i));
#endif
}
if (moves > 0 && (i == A_STR || i == A_CON)) (void)encumber_msg();
}
@@ -398,9 +392,7 @@ exerper()
(u.uhunger > 50) ? HUNGRY :
(u.uhunger > 0) ? WEAK : FAINTING;
#ifdef DEBUG
pline("exerper: Hunger checks");
#endif
debugpline("exerper: Hunger checks");
switch (hs) {
case SATIATED: exercise(A_DEX, FALSE);
if (Role_if(PM_MONK))
@@ -416,9 +408,7 @@ exerper()
}
/* Encumberance Checks */
#ifdef DEBUG
pline("exerper: Encumber checks");
#endif
debugpline("exerper: Encumber checks");
switch (near_capacity()) {
case MOD_ENCUMBER: exercise(A_STR, TRUE); break;
case HVY_ENCUMBER: exercise(A_STR, TRUE);
@@ -431,9 +421,7 @@ exerper()
/* status checks */
if(!(moves % 5)) {
#ifdef DEBUG
pline("exerper: Status checks");
#endif
debugpline("exerper: Status checks");
if ((HClairvoyant & (INTRINSIC|TIMEOUT)) &&
!BClairvoyant) exercise(A_WIS, TRUE);
if (HRegeneration) exercise(A_STR, TRUE);
@@ -464,15 +452,11 @@ exerchk()
/* Check out the periodic accumulations */
exerper();
#ifdef DEBUG
if(moves >= context.next_attrib_check)
pline("exerchk: ready to test. multi = %d.", multi);
#endif
debugpline("exerchk: ready to test. multi = %d.", multi);
/* Are we ready for a test? */
if(moves >= context.next_attrib_check && !multi) {
#ifdef DEBUG
pline("exerchk: testing.");
#endif
debugpline("exerchk: testing.");
/*
* Law of diminishing returns (Part II):
*
@@ -499,13 +483,11 @@ exerchk()
exercise/abuse gradually wears off without impact then */
if (Upolyd && i != A_WIS) goto nextattrib;
#ifdef DEBUG
pline("exerchk: testing %s (%d).",
debugpline("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?" : "???",
ax);
#endif
/*
* Law of diminishing returns (Part III):
*
@@ -515,13 +497,9 @@ exerchk()
if (rn2(AVAL) > ((i != A_WIS) ? (abs(ax) * 2 / 3) : abs(ax)))
goto nextattrib;
#ifdef DEBUG
pline("exerchk: changing %d.", i);
#endif
debugpline("exerchk: changing %d.", i);
if(adjattrib(i, mod_val, -1)) {
#ifdef DEBUG
pline("exerchk: changed %d.", i);
#endif
debugpline("exerchk: changed %d.", i);
/* if you actually changed an attrib - zero accumulation */
AEXE(i) = ax = 0;
/* then print an explanation */
@@ -535,9 +513,7 @@ exerchk()
AEXE(i) = (abs(ax) / 2) * mod_val;
}
context.next_attrib_check += rn1(200,800);
#ifdef DEBUG
pline("exerchk: next check at %ld.", context.next_attrib_check);
#endif
debugpline("exerchk: next check at %ld.", context.next_attrib_check);
}
}

View File

@@ -581,11 +581,9 @@ getbones()
for(mtmp = fmon; mtmp; mtmp = mtmp->nmon) {
if (has_mname(mtmp)) sanitize_name(MNAME(mtmp));
if (mtmp->mhpmax == DEFUNCT_MONSTER) {
#if defined(DEBUG)
if (wizard)
pline("Removing defunct monster %s from bones.",
debugpline("Removing defunct monster %s from bones.",
mtmp->data->mname);
#endif
mongone(mtmp);
} else
/* to correctly reset named artifacts on the level */

View File

@@ -5,7 +5,6 @@
#include "hack.h"
#include "func_tab.h"
/* #define DEBUG */ /* uncomment for debugging */
#ifdef ALTMETA
STATIC_VAR boolean alt_esc = FALSE;
@@ -30,12 +29,8 @@ extern const char *enc_stat[]; /* encumbrance status from botl.c */
#define CMD_CLICKLOOK (char)0x8F
#ifdef DEBUG
/*
* only one "wiz_debug_cmd" routine should be available (in whatever
* module you are trying to debug) or things are going to get rather
* hard to link :-)
*/
extern int NDECL(wiz_debug_cmd);
extern int NDECL(wiz_debug_cmd_bury);
extern int NDECL(wiz_debug_cmd_traveldisplay);
#endif
#ifdef DUMB /* stuff commented out in extern.h, but needed here */
@@ -389,11 +384,11 @@ extcmd_via_menu() /* here after # - now show pick-list of possible commands */
Sprintf(fmtstr, "%%-%ds", biggest + 15);
}
if (++i > MAX_EXT_CMD) {
# if defined(DEBUG) || defined(BETA)
# if defined(BETA)
impossible(
"Exceeded %d extended commands in doextcmd() menu; 'extmenu' disabled.",
MAX_EXT_CMD);
# endif /* DEBUG || BETA */
# endif /* BETA */
iflags.extmenu = 0;
return -1;
}
@@ -454,7 +449,7 @@ extcmd_via_menu() /* here after # - now show pick-list of possible commands */
if (n == 1) {
if (matchlevel > (QBUFSZ - 2)) {
free((genericptr_t)pick_list);
# if defined(DEBUG) || defined(BETA)
# if defined(BETA)
impossible("Too many chars (%d) entered in extcmd_via_menu()",
matchlevel);
# endif
@@ -2507,7 +2502,8 @@ struct ext_func_tab extcmdlist[] = {
{(char *)0, (char *)0, donull, TRUE}, /* vision */
{(char *)0, (char *)0, donull, TRUE}, /* wizsmell */
#ifdef DEBUG
{(char *)0, (char *)0, donull, TRUE}, /* wizdebug */
{(char *)0, (char *)0, donull, TRUE}, /* wizdebug_traveldisplay */
{(char *)0, (char *)0, donull, TRUE}, /* wizdebug_bury */
#endif
{(char *)0, (char *)0, donull, TRUE}, /* wizrumorcheck */
{(char *)0, (char *)0, donull, TRUE}, /* wmode */
@@ -2534,7 +2530,8 @@ static const struct ext_func_tab debug_extcmdlist[] = {
{"vision", "show vision array", wiz_show_vision, TRUE},
{"wizsmell", "smell monster", wiz_smell, TRUE},
#ifdef DEBUG
{"wizdebug", "wizard debug command", wiz_debug_cmd, TRUE},
{"wizdebug_traveldisplay", "wizard debug: toggle travel display", wiz_debug_cmd_traveldisplay, TRUE},
{"wizdebug_bury", "wizard debug: bury objs under and around you", wiz_debug_cmd_bury, TRUE},
#endif
{"wizrumorcheck", "verify rumor boundaries", wiz_rumor_check, TRUE},
{"wmode", "show wall modes", wiz_show_wmodes, TRUE},

View File

@@ -26,9 +26,6 @@ STATIC_DCL void FDECL(m_to_e, (struct monst *, int, int, struct entity *));
STATIC_DCL void FDECL(u_to_e, (struct entity *));
STATIC_DCL void FDECL(set_entity, (int, int, struct entity *));
STATIC_DCL const char *FDECL(e_nam, (struct entity *));
#ifdef D_DEBUG
static const char *FDECL(Enam, (struct entity *)); /* unused */
#endif
STATIC_DCL const char *FDECL(E_phrase, (struct entity *, const char *));
STATIC_DCL boolean FDECL(e_survives_at, (struct entity *, int, int));
STATIC_DCL void FDECL(e_died, (struct entity *, int, int));
@@ -253,8 +250,8 @@ int x, y;
(occupants[entitycnt].ex == x) &&
(occupants[entitycnt].ey == y))
break;
debugpline("entitycnt = %d", entitycnt);
#ifdef D_DEBUG
pline("entitycnt = %d", entitycnt);
wait_synch();
#endif
return((entitycnt == ENTITIES)?
@@ -319,19 +316,6 @@ struct entity *etmp;
return(is_u(etmp)? "you" : mon_nam(etmp->emon));
}
#ifdef D_DEBUG
/*
* Enam is another unused utility routine: E_phrase is preferable.
*/
static const char *
Enam(etmp)
struct entity *etmp;
{
return(is_u(etmp)? "You" : Monnam(etmp->emon));
}
#endif /* D_DEBUG */
/*
* Generates capitalized entity name, makes 2nd -> 3rd person conversion on
* verb, where necessary.
@@ -465,10 +449,8 @@ boolean chunks;
{
int misses;
#ifdef D_DEBUG
if (chunks)
pline("Do chunks miss?");
#endif
debugpline("Do chunks miss?");
if (automiss(etmp))
return(TRUE);
@@ -488,9 +470,7 @@ boolean chunks;
if (is_db_wall(etmp->ex, etmp->ey))
misses -= 3; /* less airspace */
#ifdef D_DEBUG
pline("Miss chance = %d (out of 8)", misses);
#endif
debugpline("Miss chance = %d (out of 8)", misses);
return((boolean)((misses >= rnd(8))? TRUE : FALSE));
}
@@ -519,9 +499,7 @@ struct entity *etmp;
if (is_db_wall(etmp->ex, etmp->ey))
tmp -= 2; /* less room to maneuver */
#ifdef D_DEBUG
pline("%s to jump (%d chances in 10)", E_phrase(etmp, "try"), tmp);
#endif
debugpline("%s to jump (%d chances in 10)", E_phrase(etmp, "try"), tmp);
return((boolean)((tmp >= rnd(10))? TRUE : FALSE));
}
@@ -554,17 +532,13 @@ struct entity *etmp;
if (at_portcullis)
pline_The("portcullis misses %s!",
e_nam(etmp));
#ifdef D_DEBUG
else
pline_The("drawbridge misses %s!",
debugpline("The drawbridge misses %s!",
e_nam(etmp));
#endif
if (e_survives_at(etmp, oldx, oldy))
return;
else {
#ifdef D_DEBUG
pline("Mon can't survive here");
#endif
debugpline("Mon can't survive here");
if (at_portcullis)
must_jump = TRUE;
else
@@ -583,9 +557,7 @@ struct entity *etmp;
if (at_portcullis) {
if (e_jumps(etmp)) {
relocates = TRUE;
#ifdef D_DEBUG
pline("Jump succeeds!");
#endif
debugpline("Jump succeeds!");
} else {
if (e_inview)
pline("%s crushed by the falling portcullis!",
@@ -598,9 +570,7 @@ struct entity *etmp;
}
} else { /* tries to jump off bridge to original square */
relocates = !e_jumps(etmp);
#ifdef D_DEBUG
pline("Jump %s!", (relocates)? "fails" : "succeeds");
#endif
debugpline("Jump %s!", (relocates)? "fails" : "succeeds");
}
}
@@ -610,17 +580,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.
*/
#ifdef D_DEBUG
pline("Doing relocation.");
#endif
debugpline("Doing relocation.");
newx = oldx;
newy = oldy;
(void)find_drawbridge(&newx, &newy);
if ((newx == oldx) && (newy == oldy))
get_wall_for_db(&newx, &newy);
#ifdef D_DEBUG
pline("Checking new square for occupancy.");
#endif
debugpline("Checking new square for occupancy.");
if (relocates && (e_at(newx, newy))) {
/*
@@ -631,30 +597,24 @@ struct entity *etmp;
struct entity *other;
other = e_at(newx, newy);
#ifdef D_DEBUG
pline("New square is occupied by %s", e_nam(other));
#endif
debugpline("New square is occupied by %s", e_nam(other));
if (e_survives_at(other, newx, newy) && automiss(other)) {
relocates = FALSE; /* "other" won't budge */
#ifdef D_DEBUG
pline("%s suicide.", E_phrase(etmp, "commit"));
#endif
debugpline("%s suicide.", E_phrase(etmp, "commit"));
} else {
#ifdef D_DEBUG
pline("Handling %s", e_nam(other));
#endif
debugpline("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));
#ifdef D_DEBUG
pline("Checking existence of %s", e_nam(etmp));
wait_synch();
#endif
if (e_at(oldx, oldy) != etmp) {
#ifdef D_DEBUG
pline("%s moved or died in recursion somewhere",
debugpline("%s moved or died in recursion somewhere",
E_phrase(etmp, "have"));
#ifdef D_DEBUG
wait_synch();
#endif
return;
@@ -662,9 +622,7 @@ struct entity *etmp;
}
}
if (relocates && !e_at(newx, newy)) {/* if e_at() entity = worm tail */
#ifdef D_DEBUG
pline("Moving %s", e_nam(etmp));
#endif
debugpline("Moving %s", e_nam(etmp));
if (!is_u(etmp)) {
remove_monster(etmp->ex, etmp->ey);
place_monster(etmp->emon, newx, newy);
@@ -677,13 +635,13 @@ struct entity *etmp;
etmp->ey = newy;
e_inview = e_canseemon(etmp);
}
debugpline("Final disposition of %s", e_nam(etmp));
#ifdef D_DEBUG
pline("Final disposition of %s", e_nam(etmp));
wait_synch();
#endif
if (is_db_wall(etmp->ex, etmp->ey)) {
debugpline("%s in portcullis chamber", E_phrase(etmp, "are"));
#ifdef D_DEBUG
pline("%s in portcullis chamber", E_phrase(etmp, "are"));
wait_synch();
#endif
if (e_inview) {
@@ -703,13 +661,9 @@ struct entity *etmp;
e_died(etmp, 0, CRUSHING); /* no message */
return;
}
#ifdef D_DEBUG
pline("%s in here", E_phrase(etmp, "survive"));
#endif
debugpline("%s in here", E_phrase(etmp, "survive"));
} else {
#ifdef D_DEBUG
pline("%s on drawbridge square", E_phrase(etmp, "are"));
#endif
debugpline("%s on drawbridge square", E_phrase(etmp, "are"));
if (is_pool(etmp->ex, etmp->ey) && !e_inview)
if (!Deaf)
You_hear("a splash.");
@@ -720,9 +674,7 @@ struct entity *etmp;
E_phrase(etmp, "fall"));
return;
}
#ifdef D_DEBUG
pline("%s cannot survive on the drawbridge square",Enam(etmp));
#endif
debugpline("%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. */
@@ -938,9 +890,7 @@ int x,y;
if (etmp1->edata) {
e_inview = e_canseemon(etmp1);
if (e_missed(etmp1, TRUE)) {
#ifdef D_DEBUG
pline("%s spared!", E_phrase(etmp1, "are"));
#endif
debugpline("%s spared!", E_phrase(etmp1, "are"));
/* if there is water or lava here, fall in now */
if (is_u(etmp1))
spoteffects(FALSE);
@@ -957,11 +907,9 @@ int x,y;
} else {
if (!Deaf && !is_u(etmp1) && !is_pool(x,y))
You_hear("a crushing sound.");
#ifdef D_DEBUG
else
pline("%s from shrapnel",
debugpline("%s from shrapnel",
E_phrase(etmp1, "die"));
#endif
}
killer.format = KILLED_BY_AN;
Strcpy(killer.name, "collapsing drawbridge");

View File

@@ -5,8 +5,6 @@
#include "hack.h"
/* #define DEBUG */ /* turn on for diagnostics */
static NEARDATA boolean did_dig_msg;
STATIC_DCL boolean NDECL(rm_waslit);
@@ -1692,9 +1690,7 @@ bury_an_obj(otmp)
struct obj *otmp2;
boolean under_ice;
#ifdef DEBUG
pline("bury_an_obj: %s", xname(otmp));
#endif
debugpline("bury_an_obj: %s", xname(otmp));
if (otmp == uball) {
unpunish();
u.utrap = rn1(50,20);
@@ -1756,10 +1752,8 @@ int x, y;
{
struct obj *otmp, *otmp2;
#ifdef DEBUG
if(level.objects[x][y] != (struct obj *)0)
pline("bury_objs: at %d, %d", x, y);
#endif
debugpline("bury_objs: at %d, %d", x, y);
for (otmp = level.objects[x][y]; otmp; otmp = otmp2)
otmp2 = bury_an_obj(otmp);
@@ -1776,9 +1770,7 @@ int x, y;
struct obj *otmp, *otmp2, *bball;
coord cc;
#ifdef DEBUG
pline("unearth_objs: at %d, %d", x, y);
#endif
debugpline("unearth_objs: at %d, %d", x, y);
cc.x = x; cc.y = y;
bball = buried_ball(&cc);
for (otmp = level.buriedobjlist; otmp; otmp = otmp2) {
@@ -1887,9 +1879,7 @@ void
bury_monst(mtmp)
struct monst *mtmp;
{
#ifdef DEBUG
pline("bury_monst: %s", mon_nam(mtmp));
#endif
debugpline("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!",
@@ -1908,9 +1898,7 @@ struct monst *mtmp;
void
bury_you()
{
#ifdef DEBUG
pline("bury_you");
#endif
debugpline("bury_you");
if (!Levitation && !Flying) {
if(u.uswallow)
You_feel("a sensation like falling into a trap!");
@@ -1927,9 +1915,7 @@ bury_you()
void
unearth_you()
{
#ifdef DEBUG
pline("unearth_you");
#endif
debugpline("unearth_you");
u.uburied = FALSE;
under_ground(0);
if(!uamul || uamul->otyp != AMULET_OF_STRANGULATION)
@@ -1940,9 +1926,7 @@ unearth_you()
void
escape_tomb()
{
#ifdef DEBUG
pline("escape_tomb");
#endif
debugpline("escape_tomb");
if ((Teleportation || can_teleport(youmonst.data)) &&
(Teleport_control || rn2(3) < Luck+2)) {
You("attempt a teleport spell.");
@@ -1974,9 +1958,7 @@ bury_obj(otmp)
struct obj *otmp;
{
#ifdef DEBUG
pline("bury_obj");
#endif
debugpline("bury_obj");
if(cansee(otmp->ox, otmp->oy))
pline_The("objects on the %s tumble into a hole!",
surface(otmp->ox, otmp->oy));
@@ -1987,7 +1969,7 @@ struct obj *otmp;
#ifdef DEBUG
int
wiz_debug_cmd() /* in this case, bury everything at your loc and around */
wiz_debug_cmd_bury() /* in this case, bury everything at your loc and around */
{
int x, y;

View File

@@ -81,6 +81,8 @@ dumpit()
s_level *x;
branch *br;
if (!showdebug()) return;
for(i = 0; i < n_dgns; i++) {
fprintf(stderr, "\n#%d \"%s\" (%s):\n", i,
DD.dname, DD.proto);

View File

@@ -5,12 +5,6 @@
#include "hack.h"
/* #define DEBUG */ /* uncomment to enable new eat code debugging */
#ifdef DEBUG
#define debugpline if (wizard) pline
#endif
STATIC_PTR int NDECL(eatmdone);
STATIC_PTR int NDECL(eatfood);
STATIC_PTR void FDECL(costly_tin, (int));
@@ -290,15 +284,11 @@ recalc_wt()
{
struct obj *piece = context.victual.piece;
#ifdef DEBUG
debugpline("Old weight = %d", piece->owt);
debugpline("Used time = %d, Req'd time = %d",
context.victual.usedtime, context.victual.reqtime);
#endif
piece->owt = weight(piece);
#ifdef DEBUG
debugpline("New weight = %d", piece->owt);
#endif
}
void
@@ -308,9 +298,7 @@ reset_eat() /* called when eating interrupted by an event */
* the round is spent eating.
*/
if(context.victual.eating && !context.victual.doreset) {
#ifdef DEBUG
debugpline("reset_eat...");
#endif
context.victual.doreset = TRUE;
}
return;
@@ -325,9 +313,7 @@ register struct obj *otmp;
(void) splitobj(otmp, otmp->quan - 1L);
else
otmp = splitobj(otmp, 1L);
#ifdef DEBUG
debugpline("split object,");
#endif
}
if (!otmp->oeaten) {
@@ -388,9 +374,7 @@ struct obj *old_obj, *new_obj;
STATIC_OVL void
do_reset_eat()
{
#ifdef DEBUG
debugpline("do_reset_eat...");
#endif
if (context.victual.piece) {
context.victual.o_id = 0;
context.victual.piece = touchfood(context.victual.piece);
@@ -731,57 +715,39 @@ register struct permonst *ptr;
switch (type) {
case FIRE_RES:
res = (ptr->mconveys & MR_FIRE) != 0;
#ifdef DEBUG
if (res) debugpline("can get fire resistance");
#endif
break;
case SLEEP_RES:
res = (ptr->mconveys & MR_SLEEP) != 0;
#ifdef DEBUG
if (res) debugpline("can get sleep resistance");
#endif
break;
case COLD_RES:
res = (ptr->mconveys & MR_COLD) != 0;
#ifdef DEBUG
if (res) debugpline("can get cold resistance");
#endif
break;
case DISINT_RES:
res = (ptr->mconveys & MR_DISINT) != 0;
#ifdef DEBUG
if (res) debugpline("can get disintegration resistance");
#endif
break;
case SHOCK_RES: /* shock (electricity) resistance */
res = (ptr->mconveys & MR_ELEC) != 0;
#ifdef DEBUG
if (res) debugpline("can get shock resistance");
#endif
break;
case POISON_RES:
res = (ptr->mconveys & MR_POISON) != 0;
#ifdef DEBUG
if (res) debugpline("can get poison resistance");
#endif
break;
case TELEPORT:
res = can_teleport(ptr);
#ifdef DEBUG
if (res) debugpline("can get teleport");
#endif
break;
case TELEPORT_CONTROL:
res = control_teleport(ptr);
#ifdef DEBUG
if (res) debugpline("can get teleport control");
#endif
break;
case TELEPAT:
res = telepathic(ptr);
#ifdef DEBUG
if (res) debugpline("can get telepathy");
#endif
break;
default:
/* res stays 0 */
@@ -800,9 +766,7 @@ register struct permonst *ptr;
{
register int chance;
#ifdef DEBUG
debugpline("Attempting to give intrinsic %d", type);
#endif
/* some intrinsics are easier to get than others */
switch (type) {
case POISON_RES:
@@ -831,9 +795,7 @@ register struct permonst *ptr;
switch (type) {
case FIRE_RES:
#ifdef DEBUG
debugpline("Trying to give fire resistance");
#endif
if(!(HFire_resistance & FROMOUTSIDE)) {
You(Hallucination ? "be chillin'." :
"feel a momentary chill.");
@@ -841,27 +803,21 @@ register struct permonst *ptr;
}
break;
case SLEEP_RES:
#ifdef DEBUG
debugpline("Trying to give sleep resistance");
#endif
if(!(HSleep_resistance & FROMOUTSIDE)) {
You_feel("wide awake.");
HSleep_resistance |= FROMOUTSIDE;
}
break;
case COLD_RES:
#ifdef DEBUG
debugpline("Trying to give cold resistance");
#endif
if(!(HCold_resistance & FROMOUTSIDE)) {
You_feel("full of hot air.");
HCold_resistance |= FROMOUTSIDE;
}
break;
case DISINT_RES:
#ifdef DEBUG
debugpline("Trying to give disintegration resistance");
#endif
if(!(HDisint_resistance & FROMOUTSIDE)) {
You_feel(Hallucination ?
"totally together, man." :
@@ -870,9 +826,7 @@ register struct permonst *ptr;
}
break;
case SHOCK_RES: /* shock (electricity) resistance */
#ifdef DEBUG
debugpline("Trying to give shock resistance");
#endif
if(!(HShock_resistance & FROMOUTSIDE)) {
if (Hallucination)
You_feel("grounded in reality.");
@@ -882,9 +836,7 @@ register struct permonst *ptr;
}
break;
case POISON_RES:
#ifdef DEBUG
debugpline("Trying to give poison resistance");
#endif
if(!(HPoison_resistance & FROMOUTSIDE)) {
You_feel(Poison_resistance ?
"especially healthy." : "healthy.");
@@ -892,9 +844,7 @@ register struct permonst *ptr;
}
break;
case TELEPORT:
#ifdef DEBUG
debugpline("Trying to give teleport");
#endif
if(!(HTeleportation & FROMOUTSIDE)) {
You_feel(Hallucination ? "diffuse." :
"very jumpy.");
@@ -902,9 +852,7 @@ register struct permonst *ptr;
}
break;
case TELEPORT_CONTROL:
#ifdef DEBUG
debugpline("Trying to give teleport control");
#endif
if(!(HTeleport_control & FROMOUTSIDE)) {
You_feel(Hallucination ?
"centered in your personal space." :
@@ -913,9 +861,7 @@ register struct permonst *ptr;
}
break;
case TELEPAT:
#ifdef DEBUG
debugpline("Trying to give telepathy");
#endif
if(!(HTelepat & FROMOUTSIDE)) {
You_feel(Hallucination ?
"in touch with the cosmos." :
@@ -926,9 +872,7 @@ register struct permonst *ptr;
}
break;
default:
#ifdef DEBUG
debugpline("Tried to give an impossible intrinsic");
#endif
break;
}
}
@@ -1059,9 +1003,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 */
#ifdef DEBUG
debugpline("using attrcurse to strip an intrinsic");
#endif
attrcurse();
break;
case PM_MIND_FLAYER:
@@ -1101,9 +1043,7 @@ register int pm;
if (conveys_STR) {
count = 1;
tmp = -1; /* use -1 as fake prop index for STR */
#ifdef DEBUG
debugpline("\"Intrinsic\" strength, %d", tmp);
#endif
}
for (i = 1; i <= LAST_PROP; i++) {
if (!intrinsic_possible(i, ptr)) continue;
@@ -1113,9 +1053,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)) {
#ifdef DEBUG
debugpline("Intrinsic %d replacing %d", i, tmp);
#endif
tmp = i;
}
}
@@ -1659,13 +1597,11 @@ start_eating(otmp) /* called as you start to eat */
{
const char *old_nomovemsg, *save_nomovemsg;
#ifdef DEBUG
debugpline("start_eating: %lx (victual = %lx)", 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);
#endif
context.victual.fullwarn = context.victual.doreset = FALSE;
context.victual.eating = TRUE;
@@ -2505,15 +2441,11 @@ doeat() /* generic "eat" command funtion (see cmd.c) */
if (otmp->otyp == CORPSE) basenutrit = mons[otmp->corpsenm].cnutrit;
else basenutrit = objects[otmp->otyp].oc_nutrition;
#ifdef DEBUG
debugpline("before rounddiv: context.victual.reqtime == %d", context.victual.reqtime);
debugpline("oeaten == %d, basenutrit == %d", otmp->oeaten, basenutrit);
#endif
context.victual.reqtime = (basenutrit == 0 ? 0 :
rounddiv(context.victual.reqtime * (long)otmp->oeaten, basenutrit));
#ifdef DEBUG
debugpline("after rounddiv: context.victual.reqtime == %d", context.victual.reqtime);
#endif
/* calculate the modulo value (nutrit. units per round eating)
* note: this isn't exact - you actually lose a little nutrition
* due to this method.
@@ -2615,9 +2547,7 @@ register int num;
{
/* See comments in newuhs() for discussion on force_save_hs */
boolean iseating = (occupation == eatfood) || force_save_hs;
#ifdef DEBUG
debugpline("lesshungry(%d)", num);
#endif
u.uhunger += num;
if(u.uhunger >= 2000) {
if (!iseating || context.victual.canchoke) {

View File

@@ -2107,6 +2107,9 @@ int src;
} else if (src == SET_IN_SYS && match_varname(buf, "SHELLERS", 8)) {
if (sysopt.shellers) free(sysopt.shellers);
sysopt.shellers = dupstr(bufp);
} else if (src == SET_IN_SYS && match_varname(buf, "DEBUGFILES", 5)) {
if (sysopt.debugfiles) free(sysopt.debugfiles);
sysopt.debugfiles = dupstr(bufp);
} else if (src == SET_IN_SYS && match_varname(buf, "SUPPORT", 7)) {
if (sysopt.support) free(sysopt.support);
sysopt.support = dupstr(bufp);

View File

@@ -767,7 +767,7 @@ int mode;
static boolean trav_debug = FALSE;
int
wiz_debug_cmd() /* in this case, toggle display of travel debug info */
wiz_debug_cmd_traveldisplay() /* in this case, toggle display of travel debug info */
{
trav_debug = !trav_debug;
return 0;

View File

@@ -393,18 +393,14 @@ write_ls(fd, ls)
otmp = ls->id.a_obj;
ls->id = zeroany;
ls->id.a_uint = otmp->o_id;
#ifdef DEBUG
if (find_oid((unsigned)ls->id) != otmp)
panic("write_ls: can't find obj #%u!", ls->id.a_uint);
#endif
if (find_oid((unsigned)ls->id.a_uint) != otmp)
debugpline("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;
#ifdef DEBUG
if (find_mid((unsigned)ls->id, FM_EVERYWHERE) != mtmp)
panic("write_ls: can't find mon #%u!", ls->x_id);
#endif
if (find_mid((unsigned)ls->id.a_uint, FM_EVERYWHERE) != mtmp)
debugpline("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

@@ -93,9 +93,7 @@ register int x, y, n;
int cnttmp,cntdiv;
cnttmp = cnt;
# ifdef DEBUG
pline("init group call x=%d,y=%d,n=%d,cnt=%d.", x, y, n, cnt);
# endif
debugpline("init group call x=%d,y=%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] */
@@ -760,10 +758,8 @@ boolean ghostly;
mvitals[mndx].born++;
if ((int) mvitals[mndx].born >= lim && !(mons[mndx].geno & G_NOGEN) &&
!(mvitals[mndx].mvflags & G_EXTINCT)) {
#ifdef DEBUG
if (wizard) pline("Automatically extinguished %s.",
if (wizard) debugpline("Automatically extinguished %s.",
makeplural(mons[mndx].mname));
#endif
mvitals[mndx].mvflags |= G_EXTINCT;
reset_rndmonst(mndx);
}
@@ -906,11 +902,9 @@ register int mmflags;
/* if you are to make a specific monster and it has
already been genocided, return */
if (mvitals[mndx].mvflags & G_GENOD) return((struct monst *) 0);
#ifdef DEBUG
if (wizard && (mvitals[mndx].mvflags & G_EXTINCT))
pline("Explicitly creating extinct monster %s.",
debugpline("Explicitly creating extinct monster %s.",
mons[mndx].mname);
#endif
} else {
/* make a random (common) monster that can survive here.
* (the special levels ask for random monsters at specific
@@ -922,9 +916,7 @@ register int mmflags;
do {
if(!(ptr = rndmonst())) {
#ifdef DEBUG
pline("Warning: no monster.");
#endif
debugpline("Warning: no monster.");
return((struct monst *) 0); /* no more monsters! */
}
fakemon.data = ptr; /* set up for goodpos */
@@ -1260,9 +1252,7 @@ rndmonst()
}
if (mndx == SPECIAL_PM) {
/* evidently they've all been exterminated */
#ifdef DEBUG
pline("rndmonst: no common mons!");
#endif
debugpline("rndmonst: no common mons!");
return (struct permonst *)0;
} /* else `mndx' now ready for use below */
zlevel = level_difficulty();
@@ -1300,9 +1290,7 @@ rndmonst()
if (rndmonst_state.choice_count <= 0) {
/* maybe no common mons left, or all are too weak or too strong */
#ifdef DEBUG
Norep("rndmonst: choice_count=%d", rndmonst_state.choice_count);
#endif
debugpline("rndmonst: choice_count=%d", rndmonst_state.choice_count);
return (struct permonst *)0;
}

View File

@@ -4,11 +4,6 @@
/* NetHack may be freely redistributed. See license for details. */
#include "hack.h"
/* #define DEBUG */ /* uncomment to enable code debugging */
#ifdef DEBUG
#define debugpline if (wizard) pline
#endif
/* for UNIX, Rand #def'd to (long)lrand48() or (long)random() */
/* croom->lx etc are schar (width <= int), so % arith ensures that */
@@ -689,9 +684,7 @@ makelevel()
/* make a secret treasure vault, not connected to the rest */
if(do_vault()) {
xchar w,h;
#ifdef DEBUG
debugpline("trying to make a vault...");
#endif
w = 1;
h = 1;
if (check_room(&vault_x, &w, &vault_y, &h, TRUE)) {
@@ -1567,9 +1560,7 @@ xchar x, y;
*source = u.uz;
insert_branch(br, TRUE);
#ifdef DEBUG
pline("Made knox portal.");
#endif
debugpline("Made knox portal.");
place_branch(br, x, y);
}

View File

@@ -587,12 +587,10 @@ register const char *s;
int x_range = x_maze_max - x_maze_min - 2*INVPOS_X_MARGIN - 1,
y_range = y_maze_max - y_maze_min - 2*INVPOS_Y_MARGIN - 1;
#ifdef DEBUG
if (x_range <= INVPOS_X_MARGIN || y_range <= INVPOS_Y_MARGIN ||
(x_range * y_range) <= (INVPOS_DISTANCE * INVPOS_DISTANCE))
panic("inv_pos: maze is too small! (%d x %d)",
debugpline("inv_pos: maze is too small! (%d x %d)",
x_maze_max, y_maze_max);
#endif
inv_pos.x = inv_pos.y = 0; /*{occupied() => invocation_pos()}*/
do {
x = rn1(x_range, x_maze_min + INVPOS_X_MARGIN + 1);
@@ -879,10 +877,8 @@ register xchar x, y, todnum, todlevel;
impossible("portal on top of portal??");
return;
}
#ifdef DEBUG
pline("mkportal: at (%d,%d), to %s, level %d",
debugpline("mkportal: at (%d,%d), to %s, level %d",
x, y, dungeons[todnum].dname, todlevel);
#endif
ttmp->dst.dnum = todnum;
ttmp->dst.dlevel = todlevel;
return;

View File

@@ -17,8 +17,6 @@ STATIC_DCL void FDECL(insane_object,
(struct obj *,const char *,const char *,struct monst *));
STATIC_DCL void FDECL(check_contained, (struct obj *,const char *));
/*#define DEBUG_EFFECTS*/ /* show some messages for debugging */
struct icp {
int iprob; /* probability of an item type */
char iclass; /* item class */
@@ -1526,12 +1524,10 @@ 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;
#ifdef DEBUG_EFFECTS
pline_The("%s age has ice modifications:otmp->age = %ld, returning %ld.",
debugpline("The %s age has ice modifications:otmp->age = %ld, returning %ld.",
s_suffix(doname(otmp)),otmp->age, retval);
pline("Effective age of corpse: %ld.",
debugpline("Effective age of corpse: %ld.",
monstermoves - retval);
#endif
}
return retval;
}
@@ -1560,9 +1556,7 @@ 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;
#ifdef DEBUG_EFFECTS
pline("%s is now on ice at %d,%d.", The(xname(otmp)),x,y);
#endif
debugpline("%s is now on ice at %d,%d.", The(xname(otmp)),x,y);
/* Adjust the time remaining */
tleft *= ROT_ICE_ADJUSTMENT;
restart_timer = TRUE;
@@ -1588,9 +1582,7 @@ int force; /* 0 = no force so do checks, <0 = force off, >0 force on */
long age;
otmp->on_ice = 0;
#ifdef DEBUG_EFFECTS
pline("%s is no longer on ice at %d,%d.", The(xname(otmp)),x,y);
#endif
debugpline("%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

@@ -1278,10 +1278,8 @@ register struct monst *mtmp, *mtmp2;
/* transfer the monster's inventory */
for (otmp = mtmp2->minvent; otmp; otmp = otmp->nobj) {
#ifdef DEBUG
if (otmp->where != OBJ_MINVENT || otmp->ocarry != mtmp)
panic("replmon: minvent inconsistency");
#endif
debugpline("replmon: minvent inconsistency");
otmp->ocarry = mtmp2;
}
mtmp->minvent = 0;

View File

@@ -903,9 +903,7 @@ int how; /* type of query */
(*pick_list)->item.a_int = curr->oclass;
return 1;
} else {
#ifdef DEBUG
impossible("query_category: no single object match");
#endif
debugpline("query_category: no single object match");
}
return 0;
}

View File

@@ -12,8 +12,6 @@
#define QTEXT_FILE "quest.dat"
/* #define DEBUG */ /* uncomment for debugging */
/* from sp_lev.c, for deliver_splev_message() */
extern char *lev_message;
@@ -46,6 +44,8 @@ dump_qtlist() /* dump the character msg list to check appearance */
struct qtmsg *msg;
long size;
if (!showdebug()) return;
for (msg = qt_list.chrole; msg->msgnum > 0; msg++) {
pline("msgnum %d: delivery %c",
msg->msgnum, msg->delivery);
@@ -54,7 +54,10 @@ dump_qtlist() /* dump the character msg list to check appearance */
deliver_by_window(msg, NHW_TEXT);
}
}
#endif /* DEBUG */
#else
static void
dump_qtlist() { }
#endif /* !DEBUG */
static void
Fread(ptr, size, nitems, stream)
@@ -133,9 +136,7 @@ load_qtlist()
if (!qt_list.common || !qt_list.chrole)
impossible("load_qtlist: cannot load quest text.");
#ifdef DEBUG
dump_qtlist();
#endif
return; /* no ***DON'T*** close the msg_file */
}

View File

@@ -1153,9 +1153,7 @@ register int fd;
++msgcount;
}
if (msgcount) putmsghistory((char *)0, TRUE);
#ifdef DEBUG_MSGCOUNT
pline("Read %d messages from savefile.", msgcount);
#endif
debugpline("Read %d messages from savefile.", msgcount);
}
/* Clear all structures for object and monster ID mapping. */

View File

@@ -5,10 +5,6 @@
#include "hack.h"
#if defined(BETA) && !defined(DEBUG) && !defined(NODEBUG)
#define DEBUG
#endif
/* "Rand()"s definition is determined by [OS]conf.h */
#if defined(LINT) && defined(UNIX) /* rand() is long... */
extern int NDECL(rand);
@@ -26,9 +22,9 @@ int
rn2(x) /* 0 <= rn2(x) < x */
register int x;
{
#ifdef DEBUG
#ifdef BETA
if (x <= 0) {
impossible("rn2(%d) attempted", x);
debugpline("rn2(%d) attempted", x);
return(0);
}
x = RND(x);
@@ -44,9 +40,9 @@ register int x; /* good luck approaches 0, bad luck approaches (x-1) */
{
register int i, adjustment;
#ifdef DEBUG
#ifdef BETA
if (x <= 0) {
impossible("rnl(%d) attempted", x);
debugpline("rnl(%d) attempted", x);
return(0);
}
#endif
@@ -83,9 +79,9 @@ int
rnd(x) /* 1 <= rnd(x) <= x */
register int x;
{
#ifdef DEBUG
#ifdef BETA
if (x <= 0) {
impossible("rnd(%d) attempted", x);
debugpline("rnd(%d) attempted", x);
return(1);
}
x = RND(x)+1;
@@ -101,9 +97,9 @@ register int n, x;
{
register int tmp = n;
#ifdef DEBUG
#ifdef BETA
if (x < 0 || n < 0 || (x == 0 && n != 0)) {
impossible("d(%d,%d) attempted", n, x);
debugpline("d(%d,%d) attempted", n, x);
return(1);
}
#endif

View File

@@ -1210,9 +1210,7 @@ int fd, mode;
}
bwrite(fd, (genericptr_t) &minusone, sizeof(int));
}
#ifdef DEBUG_MSGCOUNT
pline("Stored %d messages into savefile.", msgcount);
#endif
debugpline("Stored %d messages into savefile.", msgcount);
/* note: we don't attempt to handle release_data() here */
}

View File

@@ -5,8 +5,6 @@
#include "hack.h"
/*#define DEBUG*/
#define PAY_SOME 2
#define PAY_BUY 1
#define PAY_CANT 0 /* too poor */
@@ -1207,9 +1205,7 @@ dopay()
}
if(!shkp) {
#ifdef DEBUG
pline("dopay: null shkp.");
#endif
debugpline("dopay: null shkp.");
return(0);
}
proceed:

View File

@@ -12,11 +12,6 @@
#include "hack.h"
#include "dlb.h"
/* #define DEBUG */ /* uncomment to enable code debugging */
#ifdef DEBUG
#define debugpline if (wizard) pline
#endif
#include "sp_lev.h"
@@ -329,10 +324,8 @@ chk:
lev = &levl[x][y];
for (; y <= ymax; y++) {
if (lev++->typ) {
#ifdef DEBUG
if(!vault)
debugpline("strange area [%d,%d] in check_room.",x,y);
#endif
if (!rn2(3)) return FALSE;
if (x < *lowx)
*lowx = x + xlim + 1;
@@ -405,9 +398,7 @@ xchar rtype, rlit;
r1 = rnd_rect(); /* Get a random rectangle */
if (!r1) { /* No more free rectangles ! */
#ifdef DEBUG
debugpline("No more rects...");
#endif
return FALSE;
}
hx = r1->hx;
@@ -1320,10 +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) {
#ifdef DEBUG
debugpline("dig_corridor: bad coords : (%d,%d) (%d,%d).",
xx,yy,tx,ty);
#endif
return FALSE;
}
if (tx > xx) dx = 1;

View File

@@ -424,12 +424,12 @@ register struct monst *mtmp;
register struct obj *otmp;
{
int freed_otmp;
boolean snuff_otmp = FALSE;
/* if monster is acquiring a thrown or kicked object, the throwing
or kicking code shouldn't continue to track and place it */
if (otmp == thrownobj) thrownobj = 0;
else if (otmp == kickedobj) kickedobj = 0;
boolean snuff_otmp = FALSE;
/* don't want hidden light source inside the monster; assumes that
engulfers won't have external inventories; whirly monsters cause
the light to be extinguished rather than letting it shine thru */

View File

@@ -20,6 +20,7 @@ sys_early_init(){
#else
sysopt.wizards = WIZARD_NAME;
#endif
sysopt.debugfiles = NULL;
sysopt.shellers = NULL;
sysopt.maxplayers = 0; /* XXX eventually replace MAX_NR_OF_PLAYERS */

View File

@@ -121,9 +121,7 @@ unsigned entflags;
struct monst fakemon; /* dummy monster */
if (!mdat) {
#ifdef DEBUG
pline("enexto() called with mdat==0");
#endif
debugpline("enexto() called with mdat==0");
/* default to player's original monster type */
mdat = &mons[u.umonster];
}

View File

@@ -1717,9 +1717,7 @@ struct obj *obj, *otmp;
if (context.bypasses)
return 0;
else {
#ifdef DEBUG
pline("%s for a moment.", Tobjnam(obj, "pulsate"));
#endif
debugpline("%s for a moment.", Tobjnam(obj, "pulsate"));
obj->bypass = 0;
}
}
@@ -3418,9 +3416,7 @@ 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 */
#ifdef WIZ_PATCH_DEBUG
pline("zapped monster hp = %d (= %d - %d)", mon->mhp-tmp,mon->mhp,tmp);
#endif
debugpline("zapped monster hp = %d (= %d - %d)", mon->mhp-tmp,mon->mhp,tmp);
mon->mhp -= tmp;
return(tmp);
}