SW: Activate ASSERT macro with RELEASE=0 builds

git-svn-id: https://svn.eduke32.com/eduke32@8349 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hendricks266 2019-12-03 09:44:56 +00:00 committed by Christoph Oelckers
parent 823e47f3e8
commit 863d35d7c2
6 changed files with 24 additions and 27 deletions

View file

@ -60,19 +60,23 @@ extern char isShareware;
#define ERR_STD_ARG __FILE__, __LINE__
void _Assert(const char *expr, const char *strFile, unsigned uLine);
#define PRODUCTION_ASSERT(f) \
do { \
if (!(f)) \
_Assert(#f,ERR_STD_ARG); \
} while (0)
#if DEBUG || defined DEBUGGINGAIDS
#define ASSERT(f) PRODUCTION_ASSERT(f)
#else
#define ASSERT(f) do { } while (0)
#endif
#if DEBUG
void HeapCheck(char *, int);
#define HEAP_CHECK() HeapCheck(__FILE__, __LINE__)
void _Assert(const char *expr, const char *strFile, unsigned uLine);
#define ASSERT(f) \
if (f) \
do { } while(0); \
else \
_Assert(#f,ERR_STD_ARG);
#define PRODUCTION_ASSERT(f) ASSERT(f)
void dsprintf(char *, char *, ...);
#define DSPRINTF dsprintf
@ -90,16 +94,8 @@ extern int DispMono;
#define RANDOM_DEBUG 1 // Set this to 1 for network testing.
#else
#define ASSERT(f) do { } while(0)
#define MONO_PRINT(str)
void _Assert(const char *expr, const char *strFile, unsigned uLine);
#define PRODUCTION_ASSERT(f) \
if (f) \
do { } while(0); \
else \
_Assert(#f,ERR_STD_ARG);
void dsprintf_null(char *str, const char *format, ...);
#define DSPRINTF dsprintf_null
//#define DSPRINTF()
@ -1164,7 +1160,7 @@ struct PLAYERstruct
short DiveDamageTics;
// Death stuff
short DeathType;
uint16_t DeathType;
short Kills;
short Killer; //who killed me
short KilledPlayer[MAX_SW_PLAYERS_REG];

View file

@ -7671,7 +7671,7 @@ pSpriteControl(PLAYERp pp)
// RULE: Sprites can only kill themselves
PRODUCTION_ASSERT(psp);
ASSERT(ValidPtr(psp));
ASSERT((uint32_t) psp->Next != 0xCCCCCCCC);
// ASSERT((uint32_t) psp->Next != 0xCCCCCCCC);
if (psp->State)
pStateControl(psp);

View file

@ -486,7 +486,7 @@ SectorSetup(void)
{
SINE_WAVE_FLOOR *swf;
short near_sect = i, base_sect = i;
short swf_ndx = 0;
uint16_t swf_ndx = 0;
short cnt = 0, sector_cnt;
int range;
int range_diff = 0;

View file

@ -6812,11 +6812,11 @@ SpriteControl(void)
u = User[i];
sp = User[i]->SpriteP;
STATE_CONTROL(i, sp, u, StateTics)
ASSERT(nexti >= 0 ? User[nexti] != NULL : TRUE);
// ASSERT(nexti >= 0 ? User[nexti] != NULL : TRUE);
#else
ASSERT(User[i]);
StateControl(i);
ASSERT(nexti >= 0 ? User[nexti] != NULL : TRUE);
// ASSERT(nexti >= 0 ? User[nexti] != NULL : TRUE);
#endif
}

View file

@ -726,7 +726,7 @@ void
SectorObjectSetupBounds(SECTOR_OBJECTp sop)
{
int xlow, ylow, xhigh, yhigh;
short sp_num, next_sp_num, sn, startwall, endwall;
short sp_num, next_sp_num, startwall, endwall;
int i, k, j;
SPRITEp BoundSprite;
SWBOOL FoundOutsideLoop = FALSE, FoundSector = FALSE;
@ -846,7 +846,7 @@ SectorObjectSetupBounds(SECTOR_OBJECTp sop)
sop->num_sectors++;
}
ASSERT(sop->num_sectors < SIZ(SectorObject[0].sector));
ASSERT((uint16_t)sop->num_sectors < SIZ(SectorObject[0].sector));
}
//
@ -967,6 +967,7 @@ SectorObjectSetupBounds(SECTOR_OBJECTp sop)
// sector
// place all sprites on list
uint16_t sn;
for (sn = 0; sn < (int)SIZ(sop->sp_num); sn++)
{
if (sop->sp_num[sn] == -1)
@ -1498,7 +1499,7 @@ PlaceSectorObjectsOnTracks(void)
}
}
ASSERT(sop->num_walls < SIZ(sop->xorig));
ASSERT((uint16_t)sop->num_walls < SIZ(sop->xorig));
if (sop->track <= -1)
continue;

View file

@ -7748,7 +7748,7 @@ void TraverseBreakableWalls(short start_sect, int x, int y, int z, short ang, in
{
sect = sectlist[sectlistplc++];
ASSERT(sectlistplc < SIZ(sectlist));
ASSERT((uint16_t)sectlistplc < SIZ(sectlist));
startwall = sector[sect].wallptr;
endwall = startwall + sector[sect].wallnum;
@ -7798,7 +7798,7 @@ void TraverseBreakableWalls(short start_sect, int x, int y, int z, short ang, in
if (k < 0)
{
sectlist[sectlistend++] = nextsector;
ASSERT(sectlistend < SIZ(sectlist));
ASSERT((uint16_t)sectlistend < SIZ(sectlist));
}
}