Fix compile on MSVC. Cannot use #ifdef inside a macro.

git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7149 4a71c877-e1ca-e34f-864e-861f7616d084
master
Per Inge Mathisen 2009-04-23 18:52:20 +00:00 committed by Git SVN Gateway
parent 3365cd06f1
commit af5182dc1a
1 changed files with 10 additions and 15 deletions

View File

@ -217,6 +217,11 @@ float droidDamage(DROID *psDroid, UDWORD damage, UDWORD weaponClass, UDWORD weap
// Check that psVictimDroid is not referred to by any other object in the game. We can dump out some
// extra data in debug builds that help track down sources of dangling pointer errors.
#ifdef DEBUG
#define DROIDREF(func, line) "Illegal reference to droid from %s line %d", func, line
#else
#define DROIDREF(func, line) "Illegal reference to droid"
#endif
BOOL droidCheckReferences(DROID *psVictimDroid)
{
int plr;
@ -232,34 +237,24 @@ BOOL droidCheckReferences(DROID *psVictimDroid)
for (i = 0; i < psStruct->numWeaps; i++)
{
ASSERT_OR_RETURN(false, (DROID *)psStruct->psTarget[i] != psVictimDroid, "Illegal reference to droid"
#ifdef DEBUG
"from %s line %d", psStruct->targetFunc[i], psStruct->targetLine[i]
#endif
);
ASSERT_OR_RETURN(false, (DROID *)psStruct->psTarget[i] != psVictimDroid, DROIDREF(psStruct->targetFunc[i], psStruct->targetLine[i]));
}
}
for (psDroid = apsDroidLists[plr]; psDroid != NULL; psDroid = psDroid->psNext)
{
unsigned int i;
ASSERT_OR_RETURN(false, (DROID *)psDroid->psTarget != psVictimDroid || psVictimDroid == psDroid, "Illegal reference to droid"
#ifdef DEBUG
"from %s line %d", psDroid->targetFunc, psDroid->targetLine
#endif
);
ASSERT_OR_RETURN(false, (DROID *)psDroid->psTarget != psVictimDroid || psVictimDroid == psDroid, DROIDREF(psDroid->targetFunc, psDroid->targetLine));
for (i = 0; i < psDroid->numWeaps; i++)
{
ASSERT_OR_RETURN(false, (DROID *)psDroid->psActionTarget[i] != psVictimDroid || psVictimDroid == psDroid, "Illegal reference to droid"
#ifdef DEBUG
"from %s line %d", psDroid->actionTargetFunc[i], psDroid->actionTargetLine[i]
#endif
);
ASSERT_OR_RETURN(false, (DROID *)psDroid->psActionTarget[i] != psVictimDroid || psVictimDroid == psDroid,
DROIDREF(psDroid->actionTargetFunc[i], psDroid->actionTargetLine[i]));
}
}
}
return true;
}
#undef DROIDREF
/* droidRelease: release all resources associated with a droid -
* should only be called by objmem - use vanishDroid preferably