* move CHECK_DROID assertion up, such that it appears _before_ the return statement; this will ensure that this assertion actually gets executed!

* Don't use two definitions for CHECK_DROID; a debug, and empty non-debug variant. This because (aside from the for-statements) the assert macro is the only thing getting invoked by the CHECK_DROID macro, and the assert macro will automatically be defined to a NO-OP if NDEBUG is defined (which is defined for non-debug builds).

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1800 4a71c877-e1ca-e34f-864e-861f7616d084
master
Giel van Schijndel 2007-06-03 16:25:21 +00:00
parent 090e5e17a4
commit 39829e9ff3
2 changed files with 2 additions and 6 deletions

View File

@ -395,9 +395,9 @@ BOOL droidDamage(DROID *psDroid, UDWORD damage, UDWORD weaponClass, UDWORD weapo
psDroid->lastHitWeapon = weaponSubClass; psDroid->lastHitWeapon = weaponSubClass;
} }
return FALSE;
CHECK_DROID(psDroid); CHECK_DROID(psDroid);
return FALSE;
} }
/* droidRelease: release all resources associated with a droid - /* droidRelease: release all resources associated with a droid -

View File

@ -387,7 +387,6 @@ extern BOOL droidAudioTrackStopped( void *psObj );
extern BOOL cyborgDroid(DROID *psDroid); extern BOOL cyborgDroid(DROID *psDroid);
/* assert if droid is bad */ /* assert if droid is bad */
#ifdef DEBUG
#define CHECK_DROID(droid) \ #define CHECK_DROID(droid) \
do { \ do { \
unsigned int i; \ unsigned int i; \
@ -411,8 +410,5 @@ do { \
if (droid->psActionTarget[i]) \ if (droid->psActionTarget[i]) \
assert(droid->psActionTarget[i]->direction >= 0.0f); \ assert(droid->psActionTarget[i]->direction >= 0.0f); \
} while (0); } while (0);
#else
#define CHECK_DROID(x)
#endif
#endif #endif