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
committed by Sean Hunt
parent ac108cd365
commit 612852f7de
32 changed files with 136 additions and 340 deletions

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