* remove macro PTRVALID

* replace all instances of PTRVALID(ptr,size) by (ptr != NULL)
 * remove asserts of style ASSERT( x == NULL || x != NULL ) because they would evaluate to true always anyhow and as such wouldn't ever trigger
 * remove macros iV_HeapAlloc and iV_HeapFree and replaced them with MALLOC and FREE respectively (that's what they expanded to anyway)

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1348 4a71c877-e1ca-e34f-864e-861f7616d084
master
Giel van Schijndel 2007-04-03 13:20:41 +00:00
parent 021b489038
commit 26f2672bfd
63 changed files with 411 additions and 450 deletions

View File

@ -162,7 +162,7 @@ BOOL heapCreate(OBJ_HEAP **ppsHeap, UDWORD size, UDWORD init, UDWORD ext)
(*ppsHeap)->pMemory = (UBYTE *)MALLOC(size * init);
/*
if (PTRVALID((*ppsHeap)->pMemory,size*init)==FALSE)
if ((*ppsHeap)->pMemory == NULL)
{
DBPRINTF(("Allocated heap memory is not valid!\n"));
}
@ -211,7 +211,7 @@ BOOL heapCreate(OBJ_HEAP **ppsHeap, UDWORD size, UDWORD init, UDWORD ext)
// Now create the free object list
heapCreateFreeList(*ppsHeap);
/*
if (PTRVALID((*ppsHeap)->pMemory,10)==FALSE)
if ((*ppsHeap)->pMemory == NULL)
{
DBPRINTF(("Allocated heap memory is not valid!\n"));
}
@ -256,7 +256,7 @@ BOOL heapAlloc(OBJ_HEAP *psHeap, void **ppObject)
UBYTE *pStart, *pEnd;
#endif
ASSERT( PTRVALID(psHeap, sizeof(OBJ_HEAP)),
ASSERT( psHeap != NULL,
"heapAlloc: Invalid heap pointer" );
if (psHeap->psFree == NULL)
@ -376,7 +376,7 @@ BOOL heapFree(OBJ_HEAP *psHeap, void *pObject)
#endif
FREE_OBJECT *psFree;
ASSERT( PTRVALID(psHeap, sizeof(OBJ_HEAP)),
ASSERT( psHeap != NULL,
"heapFree: Invalid heap pointer" );
#if DEBUG_HEAP
@ -465,7 +465,7 @@ void heapDestroy(OBJ_HEAP *psHeap)
int Heap;
#endif
ASSERT( PTRVALID(psHeap, sizeof(OBJ_HEAP)),
ASSERT( psHeap != NULL,
"heapDestroy: invalid heap pointer" );
#if DEBUG_HEAP

View File

@ -28,6 +28,5 @@
#define MALLOC(size) malloc(size)
#define FREE(ptr) do { free(ptr); ptr = NULL; } while(0)
#define PTRVALID(ptr, size) (ptr != NULL)
#endif

View File

@ -122,7 +122,7 @@ void strresReleaseIDStrings(STR_RES *psRes)
{
STR_ID *psID;
ASSERT( PTRVALID(psRes, sizeof(STR_RES)),
ASSERT( psRes != NULL,
"strresLoadFixedID: Invalid string res pointer" );
for(psID = (STR_ID*)TREAP_GETSMALLEST(psRes->psIDTreap); psID;
@ -144,7 +144,7 @@ void strresDestroy(STR_RES *psRes)
STR_BLOCK *psBlock, *psNext = NULL;
UDWORD i;
ASSERT( PTRVALID(psRes, sizeof(STR_RES)),
ASSERT( psRes != NULL,
"strresLoadFixedID: Invalid string res pointer" );
// Free the string id's
@ -192,7 +192,7 @@ BOOL strresLoadFixedID(STR_RES *psRes, STR_ID *psID, UDWORD numID)
{
UDWORD i;
ASSERT( PTRVALID(psRes, sizeof(STR_RES)),
ASSERT( psRes != NULL,
"strresLoadFixedID: Invalid string res pointer" );
for (i=0; i<numID; i++)
@ -221,7 +221,7 @@ BOOL strresGetIDNum(STR_RES *psRes, char *pIDStr, UDWORD *pIDNum)
{
STR_ID *psID;
ASSERT( PTRVALID(psRes, sizeof(STR_RES)),
ASSERT( psRes != NULL,
"strresLoadFixedID: Invalid string res pointer" );
psID = (STR_ID*)TREAP_FIND(psRes->psIDTreap, (void*)pIDStr);
@ -248,7 +248,7 @@ BOOL strresGetIDString(STR_RES *psRes, char *pIDStr, char **ppStoredID)
{
STR_ID *psID;
ASSERT( PTRVALID(psRes, sizeof(STR_RES)),
ASSERT( psRes != NULL,
"strresLoadFixedID: Invalid string res pointer" );
psID = (STR_ID*)TREAP_FIND(psRes->psIDTreap, (void*)pIDStr);
@ -272,7 +272,7 @@ BOOL strresStoreString(STR_RES *psRes, char *pID, char *pString)
STR_BLOCK *psBlock;
UDWORD id;
ASSERT( PTRVALID(psRes, sizeof(STR_RES)),
ASSERT( psRes != NULL,
"strresLoadFixedID: Invalid string res pointer" );
// Find the id for the string
@ -354,7 +354,7 @@ char *strresGetString(STR_RES *psRes, UDWORD id)
{
STR_BLOCK *psBlock;
ASSERT( PTRVALID(psRes, sizeof(STR_RES)),
ASSERT( psRes != NULL,
"strresLoadFixedID: Invalid string res pointer" );
// find the block the string is in
@ -429,7 +429,7 @@ UDWORD strresGetIDfromString(STR_RES *psRes, char *pString)
STR_BLOCK *psBlock, *psNext = NULL;
UDWORD i;
ASSERT( PTRVALID(psRes, sizeof(STR_RES)),
ASSERT( psRes != NULL,
"strresGetID: Invalid string res pointer" );
// Search through all the blocks to find the string

View File

@ -402,7 +402,7 @@ anim_GetShapeFromID( UWORD uwID )
{
psAnim3D = (ANIM3D *) psAnim;
ASSERT( PTRVALID( psAnim3D, sizeof(ANIM3D)),
ASSERT( psAnim3D != NULL,
"anim_GetShapeFromID: invalid anim pointer\n" );
return psAnim3D->psFrames;

View File

@ -131,7 +131,7 @@ animObj_HashFreeElementFunc( void * psElement )
#ifdef DEBUG
ANIM_OBJECT *psObj = (ANIM_OBJECT *) psElement;
ASSERT( PTRVALID(psObj, sizeof(ANIM_OBJECT)),
ASSERT( psObj != NULL,
"animObj_HashFreeElementFunc: object pointer invalid\n" );
#endif
}
@ -290,9 +290,6 @@ animObj_GetFirst( void )
psObj = (ANIM_OBJECT *) hashTable_GetFirst( g_pAnimObjTable );
ASSERT( psObj == NULL || PTRVALID(psObj, sizeof(ANIM_OBJECT)),
"animObj_GetFirst: object pointer not valid\n" );
return psObj;
}

View File

@ -139,7 +139,7 @@ hashTable_Create( HASHTABLE **ppsTable, UDWORD udwTableSize,
void
hashTable_Destroy( HASHTABLE *psTable )
{
ASSERT( PTRVALID(psTable, sizeof(HASHTABLE)),
ASSERT( psTable != NULL,
"hashTable_Destroy: table pointer invalid\n" );
hashTable_Clear( psTable );
@ -167,7 +167,7 @@ hashTable_Clear( HASHTABLE *psTable )
HASHNODE *psNode, *psNodeTmp;
UDWORD i;
ASSERT( PTRVALID(psTable, sizeof(HASHTABLE)),
ASSERT( psTable != NULL,
"hashTable_Destroy: table pointer invalid\n" );
/* free nodes */
@ -178,7 +178,7 @@ hashTable_Clear( HASHTABLE *psTable )
while ( psNode != NULL )
{
/* return node element to heap */
ASSERT( PTRVALID(psNode->psElement, psTable->udwElementSize),
ASSERT( psNode->psElement != NULL,
"hashTable_Destroy: element pointer invalid\n" );
/* do free-element callback if set */
@ -191,7 +191,7 @@ hashTable_Clear( HASHTABLE *psTable )
HEAP_FREE( psTable->psElementHeap, psNode->psElement );
/* return node to heap */
ASSERT( PTRVALID(psNode, sizeof(HASHNODE)),
ASSERT( psNode != NULL,
"hashTable_Destroy: node pointer invalid\n" );
psNodeTmp = psNode->psNext;
HEAP_FREE( psTable->psNodeHeap, psNode );
@ -208,7 +208,7 @@ hashTable_Clear( HASHTABLE *psTable )
void
hashTable_SetHashFunction( HASHTABLE *psTable, HASHFUNC pHashFunc )
{
ASSERT( PTRVALID(psTable, sizeof(HASHTABLE)),
ASSERT( psTable != NULL,
"hashTable_SetHashFunction: table pointer invalid\n" );
psTable->pHashFunc = pHashFunc;
@ -220,7 +220,7 @@ void
hashTable_SetFreeElementFunction( HASHTABLE *psTable,
HASHFREEFUNC pFreeFunc )
{
ASSERT( PTRVALID(psTable, sizeof(HASHTABLE)),
ASSERT( psTable != NULL,
"hashTable_SetFreeElementFunction: table pointer invalid\n" );
psTable->pFreeFunc = pFreeFunc;
@ -240,7 +240,7 @@ hashTable_GetElement( HASHTABLE *psTable )
void *psElement;
BOOL result;
ASSERT( PTRVALID(psTable, sizeof(HASHTABLE)),
ASSERT( psTable != NULL,
"hashTable_GetElement: table pointer invalid\n" );
result=HEAP_ALLOC( psTable->psElementHeap, &psElement );
@ -257,7 +257,7 @@ hashTable_GetElement( HASHTABLE *psTable )
static UDWORD
hashTable_GetHashKey( HASHTABLE *psTable, int iKey1, int iKey2 )
{
ASSERT( PTRVALID(psTable, sizeof(HASHTABLE)),
ASSERT( psTable != NULL,
"hashTable_GetFirst: hash table pointer invalid\n" );
/* get hashed index */
@ -273,9 +273,9 @@ hashTable_InsertElement( HASHTABLE *psTable, void *psElement,
UDWORD udwHashIndex;
HASHNODE *psNode;
ASSERT( PTRVALID(psTable, sizeof(HASHTABLE)),
ASSERT( psTable != NULL,
"hashTable_InsertElement: table pointer invalid\n" );
ASSERT( PTRVALID(psElement, psTable->udwElementSize),
ASSERT( psElement != NULL,
"hashTable_InsertElement: element pointer invalid\n" );
/* get hashed index */
@ -308,7 +308,7 @@ hashTable_FindElement( HASHTABLE *psTable, int iKey1, int iKey2 )
UDWORD udwHashIndex;
HASHNODE *psNode;
ASSERT( PTRVALID(psTable, sizeof(HASHTABLE)),
ASSERT( psTable != NULL,
"hashTable_FindElement: table pointer invalid\n" );
/* get hashed index */
@ -378,7 +378,7 @@ hashTable_RemoveElement( HASHTABLE *psTable, void *psElement,
UDWORD udwHashIndex;
HASHNODE *psNode, *psPrev;
ASSERT( PTRVALID(psTable, sizeof(HASHTABLE)),
ASSERT( psTable != NULL,
"hashTable_RemoveElement: table pointer invalid\n" );
/* get hashed index */
@ -425,12 +425,12 @@ hashTable_RemoveElement( HASHTABLE *psTable, void *psElement,
hashTable_SetNextNode( psTable, TRUE );
/* return element to heap */
ASSERT( PTRVALID(psNode->psElement, psTable->udwElementSize),
ASSERT( psNode->psElement != NULL,
"hashTable_RemoveElement: element pointer invalid\n" );
HEAP_FREE( psTable->psElementHeap, psNode->psElement );
/* return node to heap */
ASSERT( PTRVALID(psNode, sizeof(HASHNODE)),
ASSERT( psNode != NULL,
"hashTable_RemoveElement: node pointer invalid\n" );
HEAP_FREE( psTable->psNodeHeap, psNode );
@ -445,7 +445,7 @@ hashTable_GetNext( HASHTABLE *psTable )
{
void *psElement;
ASSERT( PTRVALID(psTable, sizeof(HASHTABLE)),
ASSERT( psTable != NULL,
"hashTable_GetNext: hash table pointer invalid\n" );
if ( psTable->psNextNode == NULL )
@ -468,7 +468,7 @@ hashTable_GetNext( HASHTABLE *psTable )
void *
hashTable_GetFirst( HASHTABLE *psTable )
{
ASSERT( PTRVALID(psTable, sizeof(HASHTABLE)),
ASSERT( psTable != NULL,
"hashTable_GetFirst: hash table pointer invalid\n" );
/* init current index and node to start of table */

View File

@ -156,9 +156,9 @@ queue_Enqueue( QUEUE * pQueue, void * psElement, int iPriority )
QUEUE_NODE *psFreeNode, *psNode, *psNodePrev;
/* check input */
ASSERT( PTRVALID(pQueue,sizeof(QUEUE)),
ASSERT( pQueue != NULL,
"queue_Enqueue: queue pointer invalid\n" );
ASSERT( PTRVALID(psElement,pQueue->iElementSize),
ASSERT( psElement != NULL,
"queue_Enqueue: element pointer invalid\n" );
#if QUEUE_INSERTION_TEST
@ -247,7 +247,7 @@ queue_Dequeue( QUEUE * pQueue )
QUEUE_NODE * psNode;
/* check input */
ASSERT( PTRVALID(pQueue,sizeof(QUEUE)),
ASSERT( pQueue != NULL,
"queue_Dequeue: queue pointer invalid\n" );
if ( pQueue->psNodeQHead != NULL )
@ -287,9 +287,9 @@ queue_FindElement( QUEUE * pQueue, void * psElement )
QUEUE_NODE *psNode, *psNodePrev;
/* check input */
ASSERT( PTRVALID(pQueue,sizeof(QUEUE)),
ASSERT( pQueue != NULL,
"queue_FindElement: queue pointer invalid\n" );
ASSERT( PTRVALID(psElement,pQueue->iElementSize),
ASSERT( psElement != NULL,
"queue_FindElement: element pointer invalid\n" );
/* init pointers to head of queue */
@ -390,9 +390,9 @@ BOOL
queue_RemoveNode( QUEUE * pQueue, QUEUE_NODE *psNode )
{
/* check input */
ASSERT( PTRVALID(pQueue,sizeof(QUEUE)),
ASSERT( pQueue != NULL,
"queue_RemoveNode: queue pointer invalid\n" );
ASSERT( PTRVALID(psNode,sizeof(QUEUE_NODE)),
ASSERT( psNode != NULL,
"queue_RemoveNode: node pointer invalid\n" );
/* if node valid, remove from queue and return to free node list */
@ -474,9 +474,9 @@ queue_RemoveElement( QUEUE * pQueue, void * psElement )
QUEUE_NODE *psNode;
/* check input */
ASSERT( PTRVALID(pQueue,sizeof(QUEUE)),
ASSERT( pQueue != NULL,
"queue_Dequeue: queue pointer invalid\n" );
ASSERT( PTRVALID(psElement,pQueue->iElementSize),
ASSERT( psElement != NULL,
"queue_RemoveElement: element pointer invalid\n" );
if ( (psNode = queue_FindElement( pQueue, psElement )) != NULL )

View File

@ -71,7 +71,7 @@ ptrList_Create( PTRLIST **ppsList, UDWORD udwInitElements,
void
ptrList_Destroy( PTRLIST *ptrList )
{
ASSERT( PTRVALID(ptrList, sizeof(PTRLIST)),
ASSERT( ptrList != NULL,
"ptrList_Destroy: list pointer invalid\n" );
ptrList_Clear( ptrList );
@ -108,7 +108,7 @@ ptrList_Clear( PTRLIST *ptrList )
{
LISTNODE *psNode, *psNodeTmp;
ASSERT( PTRVALID(ptrList, sizeof(PTRLIST)),
ASSERT( ptrList != NULL,
"ptrList_Destroy: table pointer invalid\n" );
/* free nodes */
@ -117,12 +117,12 @@ ptrList_Clear( PTRLIST *ptrList )
while ( psNode != NULL )
{
/* return node element to heap */
ASSERT( PTRVALID(psNode->psElement, ptrList->udwElementSize),
ASSERT( psNode->psElement != NULL,
"ptrList_Destroy: element pointer invalid\n" );
HEAP_FREE( ptrList->psElementHeap, psNode->psElement );
/* return node to heap */
ASSERT( PTRVALID(psNode, sizeof(LISTNODE)),
ASSERT( psNode != NULL,
"ptrList_Destroy: node pointer invalid\n" );
psNodeTmp = psNode->psNext;
HEAP_FREE( ptrList->psNodeHeap, psNode );
@ -145,7 +145,7 @@ ptrList_GetElement( PTRLIST *ptrList )
{
void *psElement;
ASSERT( PTRVALID(ptrList, sizeof(PTRLIST)),
ASSERT( ptrList != NULL,
"ptrList_GetElement: table pointer invalid\n" );
HEAP_ALLOC( ptrList->psElementHeap, &psElement );
@ -165,7 +165,7 @@ ptrList_GetElement( PTRLIST *ptrList )
void
ptrList_FreeElement( PTRLIST *ptrList, void *psElement )
{
ASSERT( PTRVALID(ptrList, sizeof(PTRLIST)),
ASSERT( ptrList != NULL,
"ptrList_FreeElement: table pointer invalid\n" );
if ( HEAP_FREE( ptrList->psElementHeap, psElement ) == FALSE )
@ -181,9 +181,9 @@ ptrList_InsertElement( PTRLIST *ptrList, void *psElement, SDWORD sdwKey )
{
LISTNODE *psNode, *psCurNode, *psPrevNode;
ASSERT( PTRVALID(ptrList, sizeof(PTRLIST)),
ASSERT( ptrList != NULL,
"ptrList_InsertElement: table pointer invalid\n" );
ASSERT( PTRVALID(psElement, ptrList->udwElementSize),
ASSERT( psElement != NULL,
"ptrList_InsertElement: element pointer invalid\n" );
/* get node from heap */
@ -234,7 +234,7 @@ ptrList_RemoveElement( PTRLIST *ptrList, void *psElement, SDWORD sdwKey )
LISTNODE *psCurNode, *psPrevNode;
BOOL bOK;
ASSERT( PTRVALID(ptrList, sizeof(PTRLIST)),
ASSERT( ptrList != NULL,
"ptrList_RemoveElement: table pointer invalid\n" );
psPrevNode = NULL;
@ -287,14 +287,14 @@ ASSERT( psCurNode->psElement == psElement,
}
/* return element to heap */
ASSERT( PTRVALID(psCurNode->psElement, ptrList->udwElementSize),
ASSERT( psCurNode->psElement != NULL,
"ptrList_RemoveElement: element pointer invalid\n" );
ASSERT( psCurNode->psElement == psElement,
"ptrList_RemoveElement: removing wrong element!\n" );
HEAP_FREE( ptrList->psElementHeap, psCurNode->psElement );
/* return node to heap */
ASSERT( PTRVALID(psCurNode, sizeof(LISTNODE)),
ASSERT( psCurNode != NULL,
"ptrList_RemoveElement: node pointer invalid\n" );
HEAP_FREE( ptrList->psNodeHeap, psCurNode );

View File

@ -452,15 +452,15 @@ void iV_IMDRelease(iIMDShape *s)
if (s) {
if (s->flags & iV_IMD_BINARY) {
iV_HeapFree(s,0);
FREE(s);
return;
}
if (s->points) {
iV_HeapFree(s->points,s->npoints * sizeof(Vector3i));
FREE(s->points);
}
if (s->connectors) {
iV_HeapFree(s->connectors,s->nconnectors * sizeof(Vector3i));
FREE(s->connectors);
}
if (s->BSPNode) {
FREE(s->BSPNode); // I used MALLOC() so i'm going to use FREE()
@ -468,16 +468,16 @@ void iV_IMDRelease(iIMDShape *s)
if (s->polys) {
for (i = 0; i < s->npolys; i++) {
if (s->polys[i].pindex) {
iV_HeapFree(s->polys[i].pindex,s->polys[i].npnts * sizeof(int));
FREE(s->polys[i].pindex);
}
if (s->polys[i].pTexAnim) {
iV_HeapFree(s->polys[i].pTexAnim,sizeof(iTexAnim));
FREE(s->polys[i].pTexAnim);
}
if (s->polys[i].vrt) {
iV_HeapFree(s->polys[i].vrt,s->polys[i].npnts * sizeof(iVertex));
FREE(s->polys[i].vrt);
}
}
iV_HeapFree(s->polys,s->npolys * sizeof(iIMDPoly));
FREE(s->polys);
}
if (s->shadowEdgeList)
{
@ -486,7 +486,7 @@ void iV_IMDRelease(iIMDShape *s)
}
iV_DEBUG0("imd[IMDRelease] = release successful\n");
d = s->next;
iV_HeapFree(s,sizeof(iIMDShape));
FREE(s);
iV_IMDRelease(d);
}
}

View File

@ -287,7 +287,7 @@ static BOOL _imd_load_polys( char **ppFileData, iIMDShape *s )
s->numFrames = 0;
s->animInterval = 0;
s->polys = (iIMDPoly *) iV_HeapAlloc(sizeof(iIMDPoly) * s->npolys);
s->polys = (iIMDPoly *) MALLOC(sizeof(iIMDPoly) * s->npolys);
if (s->polys) {
poly = s->polys;
@ -310,9 +310,9 @@ static BOOL _imd_load_polys( char **ppFileData, iIMDShape *s )
IMDVertexcount+= poly->npnts;
poly->pindex = (VERTEXID *) iV_HeapAlloc(sizeof(VERTEXID) * poly->npnts);
poly->pindex = (VERTEXID *) MALLOC(sizeof(VERTEXID) * poly->npnts);
if ((poly->vrt = (iVertex *) iV_HeapAlloc(sizeof(iVertex) * poly->npnts)) == NULL) {
if ((poly->vrt = (iVertex *) MALLOC(sizeof(iVertex) * poly->npnts)) == NULL) {
iV_Error(0xff,"(_load_polys) [poly %d] memory alloc fail (vertex struct)",i);
return FALSE;
}
@ -357,7 +357,7 @@ static BOOL _imd_load_polys( char **ppFileData, iIMDShape *s )
if (poly->flags & iV_IMD_TEXANIM) {
IMDTexAnims++;
if ((poly->pTexAnim = (iTexAnim *)iV_HeapAlloc(sizeof(iTexAnim))) == NULL) {
if ((poly->pTexAnim = (iTexAnim *)MALLOC(sizeof(iTexAnim))) == NULL) {
iV_Error(0xff,"(_load_polys) [poly %d] memory alloc fail (iTexAnim struct)",i);
return FALSE;
}
@ -664,7 +664,7 @@ static BOOL _imd_load_points( char **ppFileData, iIMDShape *s )
IMDPoints+=s->npoints;
s->points = p = (Vector3i *) iV_HeapAlloc(sizeof(Vector3i) * s->npoints);
s->points = p = (Vector3i *) MALLOC(sizeof(Vector3i) * s->npoints);
if (p == NULL) {
return FALSE;
}
@ -883,9 +883,9 @@ static BOOL _imd_load_connectors(char **ppFileData, iIMDShape *s)
IMDConnectors+=s->nconnectors;
if ((s->connectors = (Vector3i *) iV_HeapAlloc(sizeof(Vector3i) * s->nconnectors)) == NULL)
if ((s->connectors = (Vector3i *) MALLOC(sizeof(Vector3i) * s->nconnectors)) == NULL)
{
iV_Error(0xff,"(_load_connectors) iV_HeapAlloc fail");
iV_Error(0xff,"(_load_connectors) MALLOC fail");
return FALSE;
}
@ -940,7 +940,7 @@ static iIMDShape *_imd_load_level(char **ppFileData, char *FileDataEnd, int nlev
if (nlevels == 0)
return NULL;
s = (iIMDShape *) iV_HeapAlloc(sizeof(iIMDShape));
s = (iIMDShape *) MALLOC(sizeof(iIMDShape));
if (s) {
s->points = NULL;

View File

@ -86,10 +86,6 @@
//#define iV_PolyClipTex2D pie_PolyClipTex2D
//#define iV_PolyClip2D pie_PolyClip2D
//heap crash
#define iV_HeapAlloc(size) MALLOC(size)
#define iV_HeapFree(pointer,size) FREE(pointer)
/***************************************************************************/
/*
* Global Macros

View File

@ -86,7 +86,7 @@ static inline int IsPointOnPlane( PSPLANE psPlane, Vector3i * vP )
/* validate input */
#ifdef BSP_MAXDEBUG
ASSERT( PTRVALID(psPlane,sizeof(PLANE)),
ASSERT( psPlane != NULL,
"IsPointOnPlane: invalid plane\n" );
#endif
@ -149,7 +149,7 @@ void GetPlane( iIMDShape *s, UDWORD PolygonID, PSPLANE psPlane )
Vector3f Result;
iIMDPoly *psTri;
/* validate input */
ASSERT( PTRVALID(psPlane,sizeof(PLANE)),
ASSERT( psPlane != NULL,
"GetPlane: invalid plane\n" );
psTri=&(s->polys[PolygonID]);
@ -255,7 +255,7 @@ static void GetTriangleNormal( PSTRIANGLE psTri, Vector3f * psN,int pA, int pB,
Vector3f vecA, vecB;
/* validate input */
ASSERT( PTRVALID(psTri,sizeof(iIMDPoly)),
ASSERT( psTri != NULL,
"GetTriangleNormal: invalid triangle\n" );
/* get triangle edge vectors */

View File

@ -48,7 +48,7 @@ iSurface *iV_SurfaceCreate(Uint32 flags, int width, int height, int xp, int yp,
assert(buffer!=NULL); // on playstation this MUST be null
if ((s = (iSurface *) iV_HeapAlloc(sizeof(iSurface))) == NULL)
if ((s = (iSurface *) malloc(sizeof(iSurface))) == NULL)
return NULL;
s->flags = flags;
@ -83,7 +83,7 @@ void iV_SurfaceDestroy(iSurface *s)
psRendSurface = NULL;
if (s)
iV_HeapFree(s,sizeof(iSurface));
FREE(s);
}
//*************************************************************************

View File

@ -223,7 +223,7 @@ void pie_TexShutDown(void)
{
if(_TEX_PAGE[i].tex.bmp) {
j++;
iV_HeapFree(_TEX_PAGE[i].tex.bmp,_TEX_PAGE[i].tex.width * _TEX_PAGE[i].tex.height);
FREE(_TEX_PAGE[i].tex.bmp);
}
}
i++;

View File

@ -386,7 +386,7 @@ void cpPrintProgram(SCRIPT_CODE *psProg)
ARRAY_DATA *psCurrArray;
ARRAY_DEBUG *psCurrArrayDebug;
ASSERT( PTRVALID(psProg, sizeof(SCRIPT_CODE)),
ASSERT( psProg != NULL,
"cpPrintProgram: Invalid program pointer" );
debugInfo = psProg->psDebug != NULL;
@ -581,7 +581,7 @@ void cpPrintProgram(SCRIPT_CODE *psProg)
break;
}
ASSERT( (ip <= end) || PTRVALID(ip, sizeof(UDWORD)),
ASSERT( (ip <= end) || ip != NULL,
"cpPrintProgram: instruction pointer no longer valid" );
opcode = (OPCODE)(ip->v.ival >> OPCODE_SHIFT);

View File

@ -392,7 +392,7 @@ BOOL eventNewContext(SCRIPT_CODE *psCode, CONTEXT_RELEASE release,
INTERP_TYPE type;
VAL_CHUNK *psNewChunk, *psNextChunk;
ASSERT( PTRVALID(psCode, sizeof(SCRIPT_CODE)),
ASSERT( psCode != NULL,
"eventNewContext: Invalid code pointer" );
// Get a new context
@ -562,7 +562,7 @@ BOOL eventCopyContext(SCRIPT_CONTEXT *psContext, SCRIPT_CONTEXT **ppsNew)
SDWORD val;
VAL_CHUNK *psChunk, *psOChunk;
ASSERT( PTRVALID(psContext, sizeof(SCRIPT_CONTEXT)),
ASSERT( psContext,
"eventCopyContext: Invalid context pointer" );
// Get a new context
@ -599,7 +599,7 @@ BOOL eventRunContext(SCRIPT_CONTEXT *psContext, UDWORD time)
TRIGGER_DATA *psData;
SCRIPT_CODE *psCode;
ASSERT( PTRVALID(psContext, sizeof(SCRIPT_CONTEXT)),
ASSERT( psContext != NULL,
"eventNewObject: Invalid context pointer" );
// Now setup all the triggers

View File

@ -325,13 +325,13 @@ BOOL interpRunScript(SCRIPT_CONTEXT *psContext, INTERP_RUNTYPE runType, UDWORD i
UDWORD callDepth = 0;
BOOL bTraceOn=FALSE; //enable to debug function/event calls
ASSERT( PTRVALID(psContext, sizeof(SCRIPT_CONTEXT)),
ASSERT( psContext != NULL,
"interpRunScript: invalid context pointer" );
psProg = psContext->psCode;
psCurProg = psProg; //remember for future use
ASSERT( PTRVALID(psProg, sizeof(SCRIPT_CODE)),
ASSERT( psProg != NULL,
"interpRunScript: invalid script code pointer" );
if (bInterpRunning)

View File

@ -722,9 +722,9 @@ static CODE_ERROR scriptCodeFunction(FUNC_SYMBOL *psFSymbol, // The function be
INTERP_TYPE type1,type2;
ASSERT( psFSymbol != NULL, "ais_CodeFunction: Invalid function symbol pointer" );
ASSERT( PTRVALID(psPBlock, sizeof(PARAM_BLOCK)),
ASSERT( psPBlock != NULL,
"scriptCodeFunction: Invalid param block pointer" );
ASSERT( (psPBlock->size == 0) || PTRVALID(psPBlock->pCode, psPBlock->size * sizeof(INTERP_VAL)),
ASSERT( (psPBlock->size == 0) || psPBlock->pCode != NULL,
"scriptCodeFunction: Invalid parameter code pointer" );
ASSERT( ppsCBlock != NULL,
"scriptCodeFunction: Invalid generated code block pointer" );
@ -854,9 +854,9 @@ static CODE_ERROR scriptCodeCallFunction(FUNC_SYMBOL *psFSymbol, // The functio
//debug(LOG_SCRIPT, "scriptCodeCallFunction");
ASSERT( psFSymbol != NULL, "scriptCodeCallFunction: Invalid function symbol pointer" );
ASSERT( PTRVALID(psPBlock, sizeof(PARAM_BLOCK)),
ASSERT( psPBlock != NULL,
"scriptCodeCallFunction: Invalid param block pointer" );
ASSERT( (psPBlock->size == 0) || PTRVALID(psPBlock->pCode, psPBlock->size * sizeof(INTERP_VAL)),
ASSERT( (psPBlock->size == 0) || psPBlock->pCode != NULL,
"scriptCodeCallFunction: Invalid parameter code pointer" );
ASSERT( ppsCBlock != NULL,
"scriptCodeCallFunction: Invalid generated code block pointer" );
@ -896,9 +896,9 @@ static CODE_ERROR scriptCodeCallbackParams(
BOOL typeError = FALSE;
char aErrorString[255];
ASSERT( PTRVALID(psPBlock, sizeof(PARAM_BLOCK)),
ASSERT( psPBlock != NULL,
"scriptCodeCallbackParams: Invalid param block pointer" );
ASSERT( (psPBlock->size == 0) || PTRVALID(psPBlock->pCode, psPBlock->size * sizeof(INTERP_VAL)),
ASSERT( (psPBlock->size == 0) || psPBlock->pCode != NULL,
"scriptCodeCallbackParams: Invalid parameter code pointer" );
ASSERT( ppsTDecl != NULL,
"scriptCodeCallbackParams: Invalid generated code block pointer" );
@ -966,9 +966,9 @@ static CODE_ERROR scriptCodeAssignment(VAR_SYMBOL *psVariable, // The variable t
ASSERT( psVariable != NULL,
"scriptCodeAssignment: Invalid variable symbol pointer" );
ASSERT( PTRVALID(psValue, sizeof(CODE_BLOCK)),
ASSERT( psValue != NULL,
"scriptCodeAssignment: Invalid value code block pointer" );
ASSERT( PTRVALID(psValue->pCode, psValue->size * sizeof(INTERP_VAL)),
ASSERT( psValue->pCode != NULL,
"scriptCodeAssignment: Invalid value code pointer" );
ASSERT( ppsBlock != NULL,
"scriptCodeAssignment: Invalid generated code block pointer" );
@ -1029,15 +1029,15 @@ static CODE_ERROR scriptCodeObjAssignment(OBJVAR_BLOCK *psVariable,// The variab
// assign
CODE_BLOCK **ppsBlock) // Generated code
{
ASSERT( PTRVALID(psVariable, sizeof(OBJVAR_BLOCK)),
ASSERT( psVariable != NULL,
"scriptCodeObjAssignment: Invalid object variable block pointer" );
ASSERT( PTRVALID(psVariable->pCode, psVariable->size * sizeof(INTERP_VAL)),
ASSERT( psVariable->pCode != NULL,
"scriptCodeObjAssignment: Invalid object variable code pointer" );
ASSERT( psVariable->psObjVar != NULL,
"scriptCodeObjAssignment: Invalid object variable symbol pointer" );
ASSERT( PTRVALID(psValue, sizeof(CODE_BLOCK)),
ASSERT( psValue != NULL,
"scriptCodeObjAssignment: Invalid value code block pointer" );
ASSERT( PTRVALID(psValue->pCode, psValue->size * sizeof(INTERP_VAL)),
ASSERT( psValue->pCode != NULL,
"scriptCodeObjAssignment: Invalid value code pointer" );
ASSERT( ppsBlock != NULL,
"scriptCodeObjAssignment: Invalid generated code block pointer" );
@ -1076,9 +1076,9 @@ static CODE_ERROR scriptCodeObjAssignment(OBJVAR_BLOCK *psVariable,// The variab
static CODE_ERROR scriptCodeObjGet(OBJVAR_BLOCK *psVariable,// The variable to get from
CODE_BLOCK **ppsBlock) // Generated code
{
ASSERT( PTRVALID(psVariable, sizeof(OBJVAR_BLOCK)),
ASSERT( psVariable != NULL,
"scriptCodeObjAssignment: Invalid object variable block pointer" );
ASSERT( PTRVALID(psVariable->pCode, psVariable->size * sizeof(INTERP_VAL)),
ASSERT( psVariable->pCode != NULL,
"scriptCodeObjAssignment: Invalid object variable code pointer" );
ASSERT( psVariable->psObjVar != NULL,
"scriptCodeObjAssignment: Invalid object variable symbol pointer" );
@ -1121,15 +1121,15 @@ static CODE_ERROR scriptCodeArrayAssignment(ARRAY_BLOCK *psVariable,// The varia
// SDWORD elementDWords, i;
// UBYTE *pElement;
ASSERT( PTRVALID(psVariable, sizeof(ARRAY_BLOCK)),
ASSERT( psVariable != NULL,
"scriptCodeObjAssignment: Invalid object variable block pointer" );
ASSERT( PTRVALID(psVariable->pCode, psVariable->size * sizeof(INTERP_VAL)),
ASSERT( psVariable->pCode != NULL,
"scriptCodeObjAssignment: Invalid object variable code pointer" );
ASSERT( psVariable->psArrayVar != NULL,
"scriptCodeObjAssignment: Invalid object variable symbol pointer" );
ASSERT( PTRVALID(psValue, sizeof(CODE_BLOCK)),
ASSERT( psValue != NULL,
"scriptCodeObjAssignment: Invalid value code block pointer" );
ASSERT( PTRVALID(psValue->pCode, psValue->size * sizeof(INTERP_VAL)),
ASSERT( psValue->pCode != NULL,
"scriptCodeObjAssignment: Invalid value code pointer" );
ASSERT( ppsBlock != NULL,
"scriptCodeObjAssignment: Invalid generated code block pointer" );
@ -1184,9 +1184,9 @@ static CODE_ERROR scriptCodeArrayGet(ARRAY_BLOCK *psVariable,// The variable to
// SDWORD elementDWords, i;
// UBYTE *pElement;
ASSERT( PTRVALID(psVariable, sizeof(ARRAY_BLOCK)),
ASSERT( psVariable != NULL,
"scriptCodeObjAssignment: Invalid object variable block pointer" );
ASSERT( PTRVALID(psVariable->pCode, psVariable->size * sizeof(INTERP_VAL)),
ASSERT( psVariable->pCode != NULL,
"scriptCodeObjAssignment: Invalid object variable code pointer" );
ASSERT( psVariable->psArrayVar != NULL,
"scriptCodeObjAssignment: Invalid object variable symbol pointer" );
@ -1240,9 +1240,9 @@ static CODE_ERROR scriptCodeConditional(
{
UDWORD i;
ASSERT( PTRVALID(psCondBlock, sizeof(CODE_BLOCK)),
ASSERT( psCondBlock != NULL,
"scriptCodeConditional: Invalid conditional code block pointer" );
ASSERT( PTRVALID(psCondBlock->pCode, psCondBlock->size * sizeof(INTERP_VAL)),
ASSERT( psCondBlock->pCode != NULL,
"scriptCodeConditional: Invalid conditional code pointer" );
ASSERT( ppsBlock != NULL,
"scriptCodeConditional: Invalid generated code block pointer" );
@ -1281,9 +1281,9 @@ static CODE_ERROR scriptCodeParameter(CODE_BLOCK *psParam, // Code for the par
INTERP_TYPE type, // Parameter type
PARAM_BLOCK **ppsBlock) // Generated code
{
ASSERT( PTRVALID(psParam, sizeof(CODE_BLOCK)),
ASSERT( psParam != NULL,
"scriptCodeParameter: Invalid parameter code block pointer" );
ASSERT( PTRVALID(psParam->pCode, psParam->size * sizeof(INTERP_VAL)),
ASSERT( psParam->pCode != NULL,
"scriptCodeParameter: Invalid parameter code pointer" );
ASSERT( ppsBlock != NULL,
"scriptCodeParameter: Invalid generated code block pointer" );
@ -1381,9 +1381,9 @@ static CODE_ERROR scriptCodeObjectVariable(CODE_BLOCK *psObjCode, // Code for th
VAR_SYMBOL *psVar, // The object variable symbol
OBJVAR_BLOCK **ppsBlock) // Generated code
{
ASSERT( PTRVALID(psObjCode, sizeof(CODE_BLOCK)),
ASSERT( psObjCode != NULL,
"scriptCodeObjectVariable: Invalid object code block pointer" );
ASSERT( PTRVALID(psObjCode->pCode, psObjCode->size),
ASSERT( psObjCode->pCode != NULL,
"scriptCodeObjectVariable: Invalid object code pointer" );
ASSERT( psVar != NULL,
"scriptCodeObjectVariable: Invalid variable symbol pointer" );
@ -1416,9 +1416,9 @@ static CODE_ERROR scriptCodeArrayVariable(ARRAY_BLOCK *psArrayCode, // Code for
VAR_SYMBOL *psVar, // The array variable symbol
ARRAY_BLOCK **ppsBlock) // Generated code
{
ASSERT( PTRVALID(psArrayCode, sizeof(CODE_BLOCK)),
ASSERT( psArrayCode != NULL,
"scriptCodeObjectVariable: Invalid object code block pointer" );
ASSERT( PTRVALID(psArrayCode->pCode, psArrayCode->size),
ASSERT( psArrayCode->pCode != NULL,
"scriptCodeObjectVariable: Invalid object code pointer" );
ASSERT( psVar != NULL,
"scriptCodeObjectVariable: Invalid variable symbol pointer" );

View File

@ -333,7 +333,7 @@ SDWORD sound_GetNumPlaying( SDWORD iTrack )
//
static void sound_CheckSample( AUDIO_SAMPLE *psSample )
{
ASSERT( PTRVALID(psSample, sizeof(AUDIO_SAMPLE)), "sound_CheckSample: sample pointer invalid\n" );
ASSERT( psSample != NULL, "sound_CheckSample: sample pointer invalid\n" );
ASSERT( psSample->iSample >= 0 || psSample->iSample == (ALuint)SAMPLE_NOT_ALLOCATED, "sound_CheckSample: sample %i out of range\n", psSample->iSample );
// FIXME iSample always >= 0 !
// FIXME Leaving as is because if this is not always true it asserts too often

View File

@ -147,7 +147,7 @@ BOOL barGraphCreate(W_BARGRAPH **ppsWidget, W_BARINIT *psInit)
/* Free the memory used by a barGraph */
void barGraphFree(W_BARGRAPH *psWidget)
{
ASSERT( PTRVALID(psWidget, sizeof(W_BARGRAPH)),
ASSERT( psWidget != NULL,
"barGraphFree: Invalid widget pointer" );
#if W_USE_STRHEAP
@ -177,7 +177,7 @@ void widgSetBarSize(W_SCREEN *psScreen, UDWORD id, UDWORD iValue)
W_BARGRAPH *psBGraph;
UDWORD size;
ASSERT( PTRVALID(psScreen, sizeof(W_SCREEN)),
ASSERT( psScreen != NULL,
"widgSetBarSize: Invalid screen pointer" );
psBGraph = (W_BARGRAPH *)widgGetFromID(psScreen, id);
@ -208,7 +208,7 @@ void widgSetMinorBarSize(W_SCREEN *psScreen, UDWORD id, UDWORD iValue )
W_BARGRAPH *psBGraph;
UDWORD size;
ASSERT( PTRVALID(psScreen, sizeof(W_SCREEN)),
ASSERT( psScreen != NULL,
"widgSetBarSize: Invalid screen pointer" );
psBGraph = (W_BARGRAPH *)widgGetFromID(psScreen, id);

View File

@ -56,7 +56,7 @@ BOOL buttonCreate(W_BUTTON **ppsWidget, W_BUTINIT *psInit)
//#ifdef DEBUG
// if (psInit->pText)
// {
// ASSERT( PTRVALID(psInit->psFont, sizeof(PROP_FONT)),
// ASSERT( psInit->psFont != NULL,
// "buttonCreate: Invalid font pointer" );
// }
//#endif
@ -150,7 +150,7 @@ BOOL buttonCreate(W_BUTTON **ppsWidget, W_BUTINIT *psInit)
/* Free the memory used by a button */
void buttonFree(W_BUTTON *psWidget)
{
ASSERT( PTRVALID(psWidget, sizeof(W_BUTTON)),
ASSERT( psWidget != NULL,
"buttonFree: invalid button pointer" );
#if W_USE_STRHEAP
@ -175,7 +175,7 @@ void buttonFree(W_BUTTON *psWidget)
/* Initialise a button widget before it is run */
void buttonInitialise(W_BUTTON *psWidget)
{
ASSERT( PTRVALID(psWidget, sizeof(W_BUTTON)),
ASSERT( psWidget != NULL,
"buttonDisplay: Invalid widget pointer" );
psWidget->state = WBUTS_NORMAL;
@ -354,7 +354,7 @@ void buttonDisplay(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset, UDWORD *pCo
// PROP_FONT *psCurrFont;
int CurrFontID;
ASSERT( PTRVALID(psWidget, sizeof(W_BUTTON)),
ASSERT( psWidget != NULL,
"buttonDisplay: Invalid widget pointer" );
psButton = (W_BUTTON *)psWidget;

View File

@ -67,7 +67,7 @@ BOOL editBoxCreate(W_EDITBOX **ppsWidget, W_EDBINIT *psInit)
return FALSE;
}
// ASSERT( PTRVALID(psInit->psFont, sizeof(PROP_FONT)),
// ASSERT( psInit->psFont != NULL,
// "editBoxCreate: Invalid font pointer" );
/* Allocate the required memory */
@ -142,7 +142,7 @@ void editBoxFree(W_EDITBOX *psWidget)
/* Initialise an edit box widget */
void editBoxInitialise(W_EDITBOX *psWidget)
{
ASSERT( PTRVALID(psWidget, sizeof(W_EDITBOX)),
ASSERT( psWidget != NULL,
"editBoxInitialise: Invalid edit box pointer" );
psWidget->state = WEDBS_FIXED;
@ -591,7 +591,7 @@ void editBoxRun(W_EDITBOX *psWidget, W_CONTEXT *psContext)
/* Set the current string for the edit box */
void editBoxSetString(W_EDITBOX *psWidget, char *pText)
{
ASSERT( PTRVALID(psWidget, sizeof(W_EDITBOX)),
ASSERT( psWidget != NULL,
"editBoxSetString: Invalid edit box pointer" );
widgCopyString(psWidget->aText, pText);

View File

@ -152,7 +152,7 @@ static BOOL formCreatePlain(W_FORM **ppsWidget, W_FORMINIT *psInit)
/* Free a plain form widget */
static void formFreePlain(W_FORM *psWidget)
{
ASSERT( PTRVALID(psWidget, sizeof(W_FORM)),
ASSERT( psWidget != NULL,
"formFreePlain: Invalid form pointer" );
widgReleaseWidgetList(psWidget->psWidgets);
@ -240,7 +240,7 @@ static BOOL formCreateClickable(W_CLICKFORM **ppsWidget, W_FORMINIT *psInit)
/* Free a plain form widget */
static void formFreeClickable(W_CLICKFORM *psWidget)
{
ASSERT( PTRVALID(psWidget, sizeof(W_FORM)),
ASSERT( psWidget != NULL,
"formFreePlain: Invalid form pointer" );
widgReleaseWidgetList(psWidget->psWidgets);
@ -424,7 +424,7 @@ static void formFreeTabbed(W_TABFORM *psWidget)
WIDGET *psCurr;
W_FORMGETALL sGetAll;
ASSERT( PTRVALID(psWidget, sizeof(W_TABFORM)),
ASSERT( psWidget != NULL,
"formFreeTabbed: Invalid form pointer" );
formFreeTips(psWidget);
@ -517,12 +517,12 @@ BOOL formAddWidget(W_FORM *psForm, WIDGET *psWidget, W_INIT *psInit)
WIDGET **ppsList;
W_MAJORTAB *psMajor;
ASSERT( PTRVALID(psWidget, sizeof(WIDGET)),
ASSERT( psWidget != NULL,
"formAddWidget: Invalid widget pointer" );
if (psForm->style & WFORM_TABBED)
{
ASSERT( PTRVALID(psForm, sizeof(W_TABFORM)),
ASSERT( psForm != NULL,
"formAddWidget: Invalid tab form pointer" );
psTabForm = (W_TABFORM *)psForm;
if (psInit->majorID >= psTabForm->numMajor)
@ -542,7 +542,7 @@ BOOL formAddWidget(W_FORM *psForm, WIDGET *psWidget, W_INIT *psInit)
}
else
{
ASSERT( PTRVALID(psForm, sizeof(W_FORM)),
ASSERT( psForm != NULL,
"formAddWidget: Invalid form pointer" );
psWidget->psNext = psForm->psWidgets;
psForm->psWidgets = psWidget;
@ -691,7 +691,7 @@ void widgSetTabs(W_SCREEN *psScreen, UDWORD id, UWORD major, UWORD minor)
ASSERT( FALSE,"widgSetTabs: couldn't find tabbed form from id" );
return;
}
ASSERT( PTRVALID(psForm, sizeof(W_TABFORM)),
ASSERT( psForm != NULL,
"widgSetTabs: Invalid tab form pointer" );
if (major >= psForm->numMajor ||
@ -719,7 +719,7 @@ void widgGetTabs(W_SCREEN *psScreen, UDWORD id, UWORD *pMajor, UWORD *pMinor)
ASSERT( FALSE,"widgGetTabs: couldn't find tabbed form from id" );
return;
}
ASSERT( PTRVALID(psForm, sizeof(W_TABFORM)),
ASSERT( psForm != NULL,
"widgGetTabs: Invalid tab form pointer" );
*pMajor = psForm->majorT;
@ -739,7 +739,7 @@ void widgSetColour(W_SCREEN *psScreen, UDWORD id, UDWORD colour,
ASSERT( FALSE,"widgSetColour: couldn't find form from id" );
return;
}
ASSERT( PTRVALID(psForm, sizeof(W_FORM)),
ASSERT( psForm != NULL,
"widgSetColour: Invalid tab form pointer" );
if (colour >= WCOL_MAX)
@ -756,7 +756,7 @@ void formGetOrigin(W_FORM *psWidget, SDWORD *pXOrigin, SDWORD *pYOrigin)
{
W_TABFORM *psTabForm;
ASSERT( PTRVALID(psWidget, sizeof(W_FORM)),
ASSERT( psWidget != NULL,
"formGetOrigin: Invalid form pointer" );
if (psWidget->style & WFORM_TABBED)
@ -812,7 +812,7 @@ void formInitialise(W_FORM *psWidget)
if (psWidget->style & WFORM_TABBED)
{
ASSERT( PTRVALID(psWidget, sizeof(W_TABFORM)),
ASSERT( psWidget != NULL,
"formInitialise: invalid tab form pointer" );
psTabForm = (W_TABFORM *)psWidget;
psTabForm->majorT = 0;
@ -825,14 +825,14 @@ void formInitialise(W_FORM *psWidget)
}
else if (psWidget->style & WFORM_CLICKABLE)
{
ASSERT( PTRVALID(psWidget, sizeof(W_CLICKFORM)),
ASSERT( psWidget != NULL,
"formInitialise: invalid clickable form pointer" );
psClickForm = (W_CLICKFORM *)psWidget;
psClickForm->state = WCLICK_NORMAL;
}
else
{
ASSERT( PTRVALID(psWidget, sizeof(W_FORM)),
ASSERT( psWidget != NULL,
"formInitialise: invalid form pointer" );
}

View File

@ -47,7 +47,7 @@ BOOL labelCreate(W_LABEL **ppsWidget, W_LABINIT *psInit)
return FALSE;
}
// ASSERT( PTRVALID(psInit->psFont, sizeof(PROP_FONT)),
// ASSERT( psInit->psFont != NULL,
// "labelCreate: Invalid font pointer" );
/* Allocate the required memory */
@ -127,7 +127,7 @@ void labelFree(W_LABEL *psWidget)
}
#endif
ASSERT( PTRVALID(psWidget, sizeof(W_LABEL)),
ASSERT( psWidget != NULL,
"labelFree: Invalid label pointer" );
#if W_USE_MALLOC

View File

@ -144,7 +144,7 @@ BOOL sliderCreate(W_SLIDER **ppsWidget, W_SLDINIT *psInit)
/* Free the memory used by a slider */
void sliderFree(W_SLIDER *psWidget)
{
ASSERT( PTRVALID(psWidget, sizeof(W_SLIDER)),
ASSERT( psWidget != NULL,
"sliderFree: Invalid widget pointer" );
#if W_USE_STRHEAP
@ -166,7 +166,7 @@ void sliderFree(W_SLIDER *psWidget)
/* Initialise a slider widget before running it */
void sliderInitialise(W_SLIDER *psWidget)
{
ASSERT( PTRVALID(psWidget, sizeof(W_SLIDER)),
ASSERT( psWidget != NULL,
"sliderInitialise: Invalid slider pointer" );
psWidget->state = 0;
@ -180,7 +180,7 @@ UDWORD widgGetSliderPos(W_SCREEN *psScreen, UDWORD id)
WIDGET *psWidget;
psWidget = widgGetFromID(psScreen, id);
ASSERT( PTRVALID(psWidget, sizeof(W_SLIDER)),
ASSERT( psWidget != NULL,
"widgGetSliderPos: couldn't find widget from id" );
if (psWidget)
{
@ -196,7 +196,7 @@ void widgSetSliderPos(W_SCREEN *psScreen, UDWORD id, UWORD pos)
WIDGET *psWidget;
psWidget = widgGetFromID(psScreen, id);
ASSERT( PTRVALID(psWidget, sizeof(W_SLIDER)),
ASSERT( psWidget != NULL,
"widgGetSliderPos: couldn't find widget from id" );
if (psWidget)
{

View File

@ -93,13 +93,13 @@ void widgSetTipColour(W_SCREEN *psScreen, UBYTE red, UBYTE green, UBYTE blue)
void tipStart(WIDGET *psSource, char *pNewTip, int NewFontID,
UDWORD *pNewColours, SDWORD x, SDWORD y, UDWORD width, UDWORD height)
{
ASSERT( PTRVALID(psSource, sizeof(WIDGET)),
ASSERT( psSource != NULL,
"tipStart: Invalid widget pointer" );
// ASSERT( PTRVALID(pNewTip, WIDG_MAXSTR),
// ASSERT( pNewTip != NULL,
// "tipStart: Invalid tip pointer" );
// ASSERT( PTRVALID(psNewFont, sizeof(PROP_FONT)),
// ASSERT( psNewFont != NULL,
// "tipStart: Invalid font pointer" );
ASSERT( PTRVALID(pNewColours, sizeof(UDWORD) * WCOL_MAX),
ASSERT( pNewColours != NULL,
"tipStart: Invalid colours pointer" );
tipState = TIP_WAIT;
@ -120,7 +120,7 @@ void tipStart(WIDGET *psSource, char *pNewTip, int NewFontID,
*/
void tipStop(WIDGET *psSource)
{
ASSERT( PTRVALID(psSource, sizeof(WIDGET)),
ASSERT( psSource != NULL,
"tipStop: Invalid widget pointer" );
if (tipState != TIP_NONE && psSource == psWidget)

View File

@ -284,7 +284,7 @@ void widgReleaseWidgetList(WIDGET *psWidgets)
/* Release a screen and all its associated data */
void widgReleaseScreen(W_SCREEN *psScreen)
{
ASSERT( PTRVALID(psScreen, sizeof(W_SCREEN)),
ASSERT( psScreen != NULL,
"widgReleaseScreen: Invalid screen pointer" );
formFree((W_FORM *)psScreen->psForm);
@ -370,10 +370,8 @@ static BOOL widgCheckID(W_SCREEN *psScreen, UDWORD id)
///* Set the tool tip font for a screen */
//void widgSetTipFont(W_SCREEN *psScreen, PROP_FONT *psFont)
//{
// ASSERT( PTRVALID(psScreen, sizeof(W_SCREEN)),
// ASSERT( psScreen != NULL,
// "widgSetTipFont: Invalid screen pointer" );
// ASSERT( psFont == NULL || PTRVALID(psFont, sizeof(PROP_FONT)),
// "widgSetTipFont: Invalid font pointer" );
//
// psScreen->psTipFont = psFont;
//}
@ -382,10 +380,8 @@ static BOOL widgCheckID(W_SCREEN *psScreen, UDWORD id)
/* Set the tool tip font for a screen */
void widgSetTipFont(W_SCREEN *psScreen, int FontID)
{
ASSERT( PTRVALID(psScreen, sizeof(W_SCREEN)),
ASSERT( psScreen != NULL,
"widgSetTipFont: Invalid screen pointer" );
// ASSERT( psFont == NULL || PTRVALID(psFont, sizeof(PROP_FONT)),
// "widgSetTipFont: Invalid font pointer" );
psScreen->TipFontID = FontID;
}
@ -397,7 +393,7 @@ BOOL widgAddForm(W_SCREEN *psScreen, W_FORMINIT *psInit)
{
W_FORM *psParent, *psForm;
ASSERT( PTRVALID(psScreen, sizeof(W_SCREEN)),
ASSERT( psScreen != NULL,
"widgAddForm: Invalid screen pointer" );
if (widgCheckIDForm((W_FORM *)psScreen->psForm,psInit->id))
@ -445,7 +441,7 @@ BOOL widgAddLabel(W_SCREEN *psScreen, W_LABINIT *psInit)
W_LABEL *psLabel;
W_FORM *psForm;
ASSERT( PTRVALID(psScreen, sizeof(W_SCREEN)),
ASSERT( psScreen != NULL,
"widgAddLabel: Invalid screen pointer" );
if (widgCheckIDForm((W_FORM *)psScreen->psForm,psInit->id))
@ -492,7 +488,7 @@ BOOL widgAddButton(W_SCREEN *psScreen, W_BUTINIT *psInit)
W_BUTTON *psButton;
W_FORM *psForm;
ASSERT( PTRVALID(psScreen, sizeof(W_SCREEN)),
ASSERT( psScreen != NULL,
"widgAddButton: Invalid screen pointer" );
if (widgCheckIDForm((W_FORM *)psScreen->psForm,psInit->id))
@ -539,7 +535,7 @@ BOOL widgAddEditBox(W_SCREEN *psScreen, W_EDBINIT *psInit)
W_EDITBOX *psEdBox;
W_FORM *psForm;
ASSERT( PTRVALID(psScreen, sizeof(W_SCREEN)),
ASSERT( psScreen != NULL,
"widgAddEditBox: Invalid screen pointer" );
if (widgCheckIDForm((W_FORM *)psScreen->psForm,psInit->id))
@ -586,7 +582,7 @@ BOOL widgAddBarGraph(W_SCREEN *psScreen, W_BARINIT *psInit)
W_BARGRAPH *psBarGraph;
W_FORM *psForm;
ASSERT( PTRVALID(psScreen, sizeof(W_SCREEN)),
ASSERT( psScreen != NULL,
"widgAddEditBox: Invalid screen pointer" );
if (widgCheckIDForm((W_FORM *)psScreen->psForm,psInit->id))
@ -633,7 +629,7 @@ BOOL widgAddSlider(W_SCREEN *psScreen, W_SLDINIT *psInit)
W_SLIDER *psSlider;
W_FORM *psForm;
ASSERT( PTRVALID(psScreen, sizeof(W_SCREEN)),
ASSERT( psScreen != NULL,
"widgAddEditBox: Invalid screen pointer" );
if (widgCheckIDForm((W_FORM *)psScreen->psForm, psInit->id))
@ -694,7 +690,7 @@ static BOOL widgDeleteFromForm(W_FORM *psForm, UDWORD id, W_CONTEXT *psContext)
if (psForm->style & WFORM_TABBED)
{
psTabForm = (W_TABFORM *)psForm;
ASSERT( PTRVALID(psTabForm, sizeof(W_TABFORM)),
ASSERT( psTabForm != NULL,
"widgDeleteFromForm: Invalid form pointer" );
/* loop through all the tabs */
@ -748,7 +744,7 @@ static BOOL widgDeleteFromForm(W_FORM *psForm, UDWORD id, W_CONTEXT *psContext)
}
else
{
ASSERT( PTRVALID(psForm, sizeof(W_FORM)),
ASSERT( psForm != NULL,
"widgDeleteFromForm: Invalid form pointer" );
/* Delete from a normal form */
@ -801,7 +797,7 @@ void widgDelete(W_SCREEN *psScreen, UDWORD id)
{
W_CONTEXT sContext;
ASSERT( PTRVALID(psScreen, sizeof(W_SCREEN)),
ASSERT( psScreen != NULL,
"widgDelete: Invalid screen pointer" );
/* Clear the keyboard focus if necessary */
@ -921,7 +917,7 @@ static WIDGET *widgFormGetFromID(W_FORM *psForm, UDWORD id)
/* Find a widget in a screen from its ID number */
WIDGET *widgGetFromID(W_SCREEN *psScreen, UDWORD id)
{
ASSERT( PTRVALID(psScreen, sizeof(W_SCREEN)),
ASSERT( psScreen != NULL,
"widgGetFromID: Invalid screen pointer" );
return widgFormGetFromID((W_FORM *)psScreen->psForm, id);
@ -934,7 +930,7 @@ void widgHide(W_SCREEN *psScreen, UDWORD id)
WIDGET *psWidget;
psWidget = widgGetFromID(psScreen, id);
ASSERT( PTRVALID(psWidget, sizeof(WIDGET)),
ASSERT( psWidget != NULL,
"widgHide: couldn't find widget from id" );
if (psWidget)
{
@ -949,7 +945,7 @@ void widgReveal(W_SCREEN *psScreen, UDWORD id)
WIDGET *psWidget;
psWidget = widgGetFromID(psScreen, id);
ASSERT( PTRVALID(psWidget, sizeof(WIDGET)),
ASSERT( psWidget != NULL,
"widgReveal: couldn't find widget from id" );
if (psWidget)
{
@ -1252,7 +1248,7 @@ char *widgGetString(W_SCREEN *psScreen, UDWORD id)
{
WIDGET *psWidget;
ASSERT( PTRVALID(psScreen, sizeof(W_SCREEN)),
ASSERT( psScreen != NULL,
"widgGetString: Invalid screen pointer" );
/* Get the widget */
@ -1310,7 +1306,7 @@ void widgSetString(W_SCREEN *psScreen, UDWORD id, char *pText)
{
WIDGET *psWidget;
ASSERT( PTRVALID(psScreen, sizeof(W_SCREEN)),
ASSERT( psScreen != NULL,
"widgSetString: Invalid screen pointer" );
/* Get the widget */

View File

@ -285,7 +285,7 @@ BOOL actionInsideMinRange(DROID *psDroid, BASE_OBJECT *psObj, int weapon_slot)
return FALSE;
break;
}
//ASSERT( PTRVALID(psStructStats, sizeof(STRUCTURE_STATS)),
//ASSERT( psStructStats != NULL,
// "actionNewBuildPos: invalid structure stats pointer" );
// find a new destination
@ -809,7 +809,7 @@ static void actionUpdateVtolAttack( DROID *psDroid )
if (psDroid->asWeaps[i].nStat != 0)
{
psWeapStats[i] = asWeaponStats + psDroid->asWeaps[i].nStat;
ASSERT( PTRVALID(psWeapStats, sizeof(WEAPON_STATS)),
ASSERT( psWeapStats != NULL,
"actionUpdateVtolAttack: invalid weapon stats pointer" );
break;
}
@ -820,7 +820,7 @@ static void actionUpdateVtolAttack( DROID *psDroid )
if (psDroid->asWeaps[0].nStat > 0)
{
psWeapStats[0] = asWeaponStats + psDroid->asWeaps[0].nStat;
ASSERT( PTRVALID(psWeapStats, sizeof(WEAPON_STATS)),
ASSERT( psWeapStats != NULL,
"actionUpdateVtolAttack: invalid weapon stats pointer" );
}
}
@ -1168,7 +1168,7 @@ void actionUpdateDroid(DROID *psDroid)
BOOL bHasTarget;
psPropStats = asPropulsionStats + psDroid->asBits[COMP_PROPULSION].nStat;
ASSERT( PTRVALID(psPropStats, sizeof(PROPULSION_STATS)),
ASSERT( psPropStats != NULL,
"actionUpdateUnit: invalid propulsion stats pointer" );
ASSERT( psDroid->turretRotation[i] < 360, "turretRotation out of range" );
@ -2792,7 +2792,7 @@ static void actionDroidBase(DROID *psDroid, DROID_ACTION_DATA *psAction)
//Watermelon:added MinRangeResult;
UBYTE i;
ASSERT( PTRVALID(psDroid, sizeof(DROID)),
ASSERT( psDroid != NULL,
"actionUnitBase: Invalid Unit pointer" );
ASSERT( psDroid->type == OBJ_DROID,
"actionUnitBase: Unit pointer does not reference a unit" );

View File

@ -897,7 +897,7 @@ void aiUpdateDroid(DROID *psDroid)
// BOOL bTemp;
UBYTE i,targetResult = 1;
ASSERT( PTRVALID(psDroid, sizeof(DROID)),
ASSERT( psDroid != NULL,
"updateUnitAI: invalid Unit pointer" );
lookForTarget = TRUE;

View File

@ -60,7 +60,7 @@ audio_ObjectDead( void * psObj )
PROJ_OBJECT *psProj;
/* check is valid simple object pointer */
if ( !PTRVALID(psSimpleObj, sizeof(SIMPLE_OBJECT)) )
if ( psSimpleObj == NULL )
{
debug( LOG_NEVER, "audio_ObjectDead: simple object pointer invalid\n" );
return TRUE;
@ -70,7 +70,7 @@ audio_ObjectDead( void * psObj )
if ( psSimpleObj->type == OBJ_BULLET )
{
psProj = (PROJ_OBJECT *) psSimpleObj;
if ( !PTRVALID(psProj, sizeof(PROJ_OBJECT)) )
if ( psProj == NULL )
{
debug( LOG_NEVER, "audio_ObjectDead: projectile object pointer invalid\n" );
return TRUE;
@ -93,7 +93,7 @@ audio_ObjectDead( void * psObj )
psBaseObj = (BASE_OBJECT *) psObj;
/* check is valid pointer */
if ( !PTRVALID(psBaseObj, sizeof(BASE_OBJECT)) )
if ( psBaseObj == NULL )
{
debug( LOG_NEVER, "audio_ObjectDead: base object pointer invalid\n" );
return TRUE;
@ -188,7 +188,7 @@ audio_GetObjectPos( void *psObj, SDWORD *piX, SDWORD *piY, SDWORD *piZ )
BASE_OBJECT *psBaseObj = (BASE_OBJECT *) psObj;
/* check is valid pointer */
ASSERT( PTRVALID(psBaseObj, sizeof(BASE_OBJECT)),
ASSERT( psBaseObj != NULL,
"audio_GetObjectPos: game object pointer invalid\n" );
*piX = psBaseObj->x;
@ -215,7 +215,7 @@ audio_GetClusterCentre( void *psClusterObj, SDWORD *piX, SDWORD *piY, SDWORD *pi
BOOL bDroidInClusterMoving = FALSE;
/* check valid pointer */
ASSERT( PTRVALID(psDroid, sizeof(DROID)),
ASSERT( psDroid != NULL,
"audio_GetClusterCentre: game object pointer invalid\n" );
iNumObj = *piX = *piY = *piZ = 0;
@ -273,7 +273,7 @@ audio_GetNewClusterObject( void **psClusterObj, SDWORD iClusterID )
DROID *psDroid = (DROID *) *psClusterObj;
/* check valid pointer */
ASSERT( PTRVALID(psDroid, sizeof(DROID)),
ASSERT( psDroid != NULL,
"audio_GetNewClusterObject: game object pointer invalid\n" );
/* return if droid not dead */

View File

@ -227,7 +227,7 @@ void cmdDroidUpdateKills(DROID *psKiller)
{
DROID *psCommander;
ASSERT( PTRVALID(psKiller, sizeof(DROID)),
ASSERT( psKiller != NULL,
"cmdUnitUpdateKills: invalid Unit pointer" );
if ( (psKiller->psGroup != NULL) &&
@ -243,7 +243,7 @@ SDWORD cmdGetCommanderLevel(DROID *psDroid)
{
DROID *psCommander;
ASSERT( PTRVALID(psDroid, sizeof(DROID)),
ASSERT( psDroid != NULL,
"cmdGetCommanderLevel: invalid droid pointer" );
if ( (psDroid->psGroup != NULL) &&

View File

@ -123,11 +123,11 @@ void combFire(WEAPON *psWeap, BASE_OBJECT *psAttacker, BASE_OBJECT *psTarget, in
//Watermelon:dist
SDWORD dist;
ASSERT( PTRVALID(psWeap, sizeof(WEAPON)),
ASSERT( psWeap != NULL,
"combFire: Invalid weapon pointer" );
ASSERT( PTRVALID(psAttacker, sizeof(BASE_OBJECT)),
ASSERT( psAttacker != NULL,
"combFire: Invalid attacker pointer" );
ASSERT( PTRVALID(psTarget, sizeof(BASE_OBJECT)),
ASSERT( psTarget != NULL,
"combFire: Invalid target pointer" );
/* Watermelon:dont shoot if the weapon_slot of a vtol is empty */

View File

@ -1036,7 +1036,7 @@ void displayCompObj(BASE_OBJECT *psObj, BOOL bButton)
/* get propulsion stats */
psPropStats = asPropulsionStats + psDroid->asBits[COMP_PROPULSION].nStat;
ASSERT( PTRVALID(psPropStats, sizeof(PROPULSION_STATS)),
ASSERT( psPropStats != NULL,
"moveUpdateUnit: invalid propulsion stats pointer" );
/* render vtol jet if flying - horrible hack - GJ */

View File

@ -987,7 +987,7 @@ static void dataAudioRelease( void *pData )
{
TRACK *psTrack = (TRACK *) pData;
ASSERT( PTRVALID(psTrack, sizeof(TRACK)),
ASSERT( psTrack != NULL,
"dataAudioRelease: invalid track pointer" );
audio_ReleaseTrack( psTrack );

View File

@ -1767,7 +1767,7 @@ static BOOL _intSetSystemForm(COMP_BASE_STATS *psStats)
if (psStats->ref >= REF_SENSOR_START &&
psStats->ref < REF_SENSOR_START + REF_RANGE)
{
ASSERT( PTRVALID(psStats, sizeof(SENSOR_STATS)),
ASSERT( psStats != NULL,
"intAddSystemForm: Invalid sensor stats pointer" );
psSensor = (SENSOR_STATS *)psStats;
@ -1836,7 +1836,7 @@ static BOOL _intSetSystemForm(COMP_BASE_STATS *psStats)
else if (psStats->ref >= REF_ECM_START &&
psStats->ref < REF_ECM_START + REF_RANGE)
{
ASSERT( PTRVALID(psStats, sizeof(ECM_STATS)),
ASSERT( psStats != NULL,
"intAddSystemForm: Invalid ecm stats pointer" );
psECM = (ECM_STATS *)psStats;
@ -1887,7 +1887,7 @@ static BOOL _intSetSystemForm(COMP_BASE_STATS *psStats)
else if (psStats->ref >= REF_CONSTRUCT_START &&
psStats->ref < REF_CONSTRUCT_START + REF_RANGE)
{
ASSERT( PTRVALID(psStats, sizeof(CONSTRUCT_STATS)),
ASSERT( psStats != NULL,
"intAddSystemForm: Invalid constructor stats pointer" );
psConst = (CONSTRUCT_STATS *)psStats;
@ -1938,7 +1938,7 @@ static BOOL _intSetSystemForm(COMP_BASE_STATS *psStats)
else if (psStats->ref >= REF_REPAIR_START &&
psStats->ref < REF_REPAIR_START + REF_RANGE)
{
ASSERT( PTRVALID(psStats, sizeof(REPAIR_STATS)),
ASSERT( psStats != NULL,
"intAddSystemForm: Invalid repair stats pointer" );
psRepair = (REPAIR_STATS *)psStats;
@ -1981,7 +1981,7 @@ static BOOL _intSetSystemForm(COMP_BASE_STATS *psStats)
else if (psStats->ref >= REF_WEAPON_START &&
psStats->ref < REF_WEAPON_START + REF_RANGE)
{
ASSERT( PTRVALID(psStats, sizeof(WEAPON_STATS)),
ASSERT( psStats != NULL,
"intAddSystemForm: Invalid ecm stats pointer" );
psWeapon = (WEAPON_STATS *)psStats;
@ -2110,7 +2110,7 @@ static BOOL intSetPropulsionForm(PROPULSION_STATS *psStats)
// W_LABINIT sTitleInit;
DES_PROPMODE newPropMode=(DES_PROPMODE)0;
ASSERT( PTRVALID(psStats, sizeof(PROPULSION_STATS)),
ASSERT( psStats != NULL,
"intAddPropulsionForm: Invalid propulsion stats pointer" );
memset(&sFormInit, 0, sizeof(W_FORMINIT));
@ -2724,7 +2724,7 @@ static BOOL intAddComponentButtons(COMP_BASE_STATS *psStats, UDWORD size,
{
psPropStats = asPropulsionStats + sCurrDesign.
asParts[COMP_PROPULSION];
ASSERT( PTRVALID(psPropStats, sizeof(PROPULSION_STATS)),
ASSERT( psPropStats != NULL,
"intAddComponentButtons: invalid propulsion stats pointer" );
if (asPropulsionTypes[psPropStats->propulsionType].travel == AIR)
{
@ -3084,7 +3084,7 @@ static void intSetSystemStats(COMP_BASE_STATS *psStats)
{
W_FORM *psForm;
ASSERT( PTRVALID(psStats, sizeof(COMP_BASE_STATS)),
ASSERT( psStats != NULL,
// (((UBYTE *)psStats >= (UBYTE *)asCommandDroids) &&
// ((UBYTE *)psStats < (UBYTE *)asCommandDroids + sizeof(asCommandDroids))),
"intSetSystemStats: Invalid stats pointer" );
@ -3214,7 +3214,7 @@ static void intSetSystemShadowStats(COMP_BASE_STATS *psStats)
/* Set the bar graphs for the sensor stats */
static void intSetSensorStats(SENSOR_STATS *psStats)
{
ASSERT( PTRVALID(psStats, sizeof(SENSOR_STATS)),
ASSERT( psStats != NULL,
"intSetSensorStats: Invalid stats pointer" );
ASSERT( (psStats->ref >= REF_SENSOR_START) &&
(psStats->ref < REF_SENSOR_START + REF_RANGE),
@ -3235,8 +3235,6 @@ static void intSetSensorStats(SENSOR_STATS *psStats)
/* Set the shadow bar graphs for the sensor stats */
static void intSetSensorShadowStats(SENSOR_STATS *psStats)
{
ASSERT( psStats == NULL || PTRVALID(psStats, sizeof(SENSOR_STATS)),
"intSetSensorShadowStats: Invalid stats pointer" );
ASSERT( psStats == NULL ||
((psStats->ref >= REF_SENSOR_START) &&
(psStats->ref < REF_SENSOR_START + REF_RANGE)),
@ -3268,7 +3266,7 @@ static void intSetSensorShadowStats(SENSOR_STATS *psStats)
/* Set the bar graphs for the ECM stats */
static void intSetECMStats(ECM_STATS *psStats)
{
ASSERT( PTRVALID(psStats, sizeof(ECM_STATS)),
ASSERT( psStats != NULL,
"intSetECMStats: Invalid stats pointer" );
ASSERT( (psStats->ref >= REF_ECM_START) &&
(psStats->ref < REF_ECM_START + REF_RANGE),
@ -3285,8 +3283,6 @@ static void intSetECMStats(ECM_STATS *psStats)
/* Set the shadow bar graphs for the ECM stats */
static void intSetECMShadowStats(ECM_STATS *psStats)
{
ASSERT( psStats == NULL || PTRVALID(psStats, sizeof(ECM_STATS)),
"intSetECMShadowStats: Invalid stats pointer" );
ASSERT( psStats == NULL ||
((psStats->ref >= REF_ECM_START) &&
(psStats->ref < REF_ECM_START + REF_RANGE)),
@ -3313,10 +3309,10 @@ static void intSetECMShadowStats(ECM_STATS *psStats)
/* Set the bar graphs for the Constructor stats */
static void intSetConstructStats(CONSTRUCT_STATS *psStats)
{
ASSERT( PTRVALID(psStats, sizeof(CONSTRUCT_STATS)),
ASSERT( psStats != NULL,
"intSetConstructStats: Invalid stats pointer" );
ASSERT( (psStats->ref >= REF_CONSTRUCT_START) &&
(psStats->ref < REF_CONSTRUCT_START + REF_RANGE),
(psStats->ref < REF_CONSTRUCT_START + REF_RANGE),
"intSetConstructStats: stats ref is out of range" );
/* power */
@ -3331,8 +3327,6 @@ static void intSetConstructStats(CONSTRUCT_STATS *psStats)
/* Set the shadow bar graphs for the Constructor stats */
static void intSetConstructShadowStats(CONSTRUCT_STATS *psStats)
{
ASSERT( psStats == NULL || PTRVALID(psStats, sizeof(CONSTRUCT_STATS)),
"intSetConstructShadowStats: Invalid stats pointer" );
ASSERT( psStats == NULL ||
((psStats->ref >= REF_CONSTRUCT_START) &&
(psStats->ref < REF_CONSTRUCT_START + REF_RANGE)),
@ -3358,7 +3352,7 @@ static void intSetConstructShadowStats(CONSTRUCT_STATS *psStats)
/* Set the bar graphs for the Repair stats */
static void intSetRepairStats(REPAIR_STATS *psStats)
{
ASSERT( PTRVALID(psStats, sizeof(REPAIR_STATS)),
ASSERT( psStats != NULL,
"intSetRepairStats: Invalid stats pointer" );
ASSERT( (psStats->ref >= REF_REPAIR_START) &&
(psStats->ref < REF_REPAIR_START + REF_RANGE),
@ -3376,8 +3370,6 @@ static void intSetRepairStats(REPAIR_STATS *psStats)
/* Set the shadow bar graphs for the Repair stats */
static void intSetRepairShadowStats(REPAIR_STATS *psStats)
{
ASSERT( psStats == NULL || PTRVALID(psStats, sizeof(REPAIR_STATS)),
"intSetRepairShadowStats: Invalid stats pointer" );
ASSERT( psStats == NULL ||
((psStats->ref >= REF_REPAIR_START) &&
(psStats->ref < REF_REPAIR_START + REF_RANGE)),
@ -3404,7 +3396,7 @@ static void intSetRepairShadowStats(REPAIR_STATS *psStats)
/* Set the bar graphs for the Weapon stats */
static void intSetWeaponStats(WEAPON_STATS *psStats)
{
ASSERT( PTRVALID(psStats, sizeof(WEAPON_STATS)),
ASSERT( psStats != NULL,
"intSetWeaponStats: Invalid stats pointer" );
ASSERT( (psStats->ref >= REF_WEAPON_START) &&
(psStats->ref < REF_WEAPON_START + REF_RANGE),
@ -3424,8 +3416,6 @@ static void intSetWeaponStats(WEAPON_STATS *psStats)
/* Set the shadow bar graphs for the Weapon stats */
static void intSetWeaponShadowStats(WEAPON_STATS *psStats)
{
ASSERT( psStats == NULL || PTRVALID(psStats, sizeof(WEAPON_STATS)),
"intSetWeaponShadowStats: Invalid stats pointer" );
ASSERT( psStats == NULL ||
((psStats->ref >= REF_WEAPON_START) &&
(psStats->ref < REF_WEAPON_START + REF_RANGE)),
@ -3458,7 +3448,7 @@ static void intSetBodyStats(BODY_STATS *psStats)
{
W_FORM *psForm;
ASSERT( PTRVALID(psStats, sizeof(BODY_STATS)),
ASSERT( psStats != NULL,
"intSetBodyStats: Invalid stats pointer" );
ASSERT( (psStats->ref >= REF_BODY_START) &&
(psStats->ref < REF_BODY_START + REF_RANGE),
@ -3503,8 +3493,6 @@ static void intSetBodyStats(BODY_STATS *psStats)
/* Set the shadow bar graphs for the Body stats */
static void intSetBodyShadowStats(BODY_STATS *psStats)
{
ASSERT( psStats == NULL || PTRVALID(psStats, sizeof(BODY_STATS)),
"intSetBodyShadowStats: Invalid stats pointer" );
ASSERT( psStats == NULL ||
((psStats->ref >= REF_BODY_START) &&
(psStats->ref < REF_BODY_START + REF_RANGE)),
@ -3772,7 +3760,7 @@ static void intSetPropulsionStats(PROPULSION_STATS *psStats)
W_FORM *psForm;
UDWORD weight;
ASSERT( PTRVALID(psStats, sizeof(PROPULSION_STATS)),
ASSERT( psStats != NULL,
"intSetPropulsionStats: Invalid stats pointer" );
ASSERT( (psStats->ref >= REF_PROPULSION_START) &&
(psStats->ref < REF_PROPULSION_START + REF_RANGE),
@ -3830,8 +3818,6 @@ static void intSetPropulsionShadowStats(PROPULSION_STATS *psStats)
UDWORD weight;
ASSERT( psStats == NULL || PTRVALID(psStats, sizeof(PROPULSION_STATS)),
"intSetPropulsionShadowStats: Invalid stats pointer" );
ASSERT( psStats == NULL ||
((psStats->ref >= REF_PROPULSION_START) &&
(psStats->ref < REF_PROPULSION_START + REF_RANGE)),

View File

@ -1359,7 +1359,7 @@ renderAnimComponent( COMPONENT_OBJECT *psObj )
UDWORD brightness, specular;
// SDWORD centreX, centreZ;
ASSERT( PTRVALID(psParentObj, sizeof(SIMPLE_OBJECT)),
ASSERT( psParentObj != NULL,
"renderAnimComponent: invalid parent object pointer" );
/* only draw visible bits */
@ -3040,7 +3040,7 @@ void renderDroid( DROID *psDroid )
// psPropStats = asPropulsionStats + psDroid->asBits[COMP_PROPULSION].nStat;
// ASSERT( PTRVALID(psPropStats, sizeof(PROPULSION_STATS)),
// ASSERT( psPropStats != NULL,
// "moveUpdateDroid: invalid propulsion stats pointer" );
/*

View File

@ -173,7 +173,7 @@ BOOL droidDamage(DROID *psDroid, UDWORD damage, UDWORD weaponClass, UDWORD weapo
SDWORD level, cmdLevel;
DROID_HIT_SIDE impact_side;
ASSERT( PTRVALID(psDroid, sizeof(DROID)),
ASSERT( psDroid != NULL,
"unitDamage: Invalid Unit pointer" );
//EMP cannons do not do body damage
@ -1034,10 +1034,10 @@ static void droidFlameFallCallback( ANIM_OBJECT * psObj )
{
DROID *psDroid;
ASSERT( PTRVALID(psObj, sizeof(ANIM_OBJECT)),
ASSERT( psObj != NULL,
"unitFlameFallCallback: invalid anim object pointer\n" );
psDroid = (DROID *) psObj->psParent;
ASSERT( PTRVALID(psDroid, sizeof(DROID)),
ASSERT( psDroid != NULL,
"unitFlameFallCallback: invalid Unit pointer\n" );
psDroid->psCurAnim = NULL;
@ -1049,10 +1049,10 @@ static void droidBurntCallback( ANIM_OBJECT * psObj )
{
DROID *psDroid;
ASSERT( PTRVALID(psObj, sizeof(ANIM_OBJECT)),
ASSERT( psObj != NULL,
"unitBurntCallback: invalid anim object pointer\n" );
psDroid = (DROID *) psObj->psParent;
ASSERT( PTRVALID(psDroid, sizeof(DROID)),
ASSERT( psDroid != NULL,
"unitBurntCallback: invalid Unit pointer\n" );
/* add falling anim */
@ -1072,7 +1072,7 @@ void droidBurn( DROID * psDroid )
{
BOOL bRet;
ASSERT( PTRVALID(psDroid, sizeof(DROID)),
ASSERT( psDroid != NULL,
"unitBurn: invalid Unit pointer\n" );
if ( psDroid->droidType != DROID_PERSON )
@ -1276,7 +1276,7 @@ void droidUpdate(DROID *psDroid)
SDWORD damageToDo;
ASSERT( PTRVALID(psDroid, sizeof(DROID)),
ASSERT( psDroid != NULL,
"unitUpdate: Invalid unit pointer" );
// ASSERT( psDroid->x != 0 && psDroid->y != 0,
@ -1554,7 +1554,7 @@ BOOL droidStartFoundation(DROID *psDroid)
{
// SDWORD height;
ASSERT( PTRVALID(psDroid, sizeof(DROID)),
ASSERT( psDroid != NULL,
"unitStartFoundation: invalid unit pointer" );
/* See if we are starting a new structure */
@ -1583,7 +1583,7 @@ droidCheckBuildStillInProgress( AUDIO_SAMPLE *psSample )
{
DROID *psDroid;
ASSERT( PTRVALID(psSample, sizeof(AUDIO_SAMPLE)),
ASSERT( psSample != NULL,
"unitCheckBuildStillInProgress: audio sample pointer invalid\n" );
if ( psSample->psObj == NULL )
@ -1593,7 +1593,7 @@ droidCheckBuildStillInProgress( AUDIO_SAMPLE *psSample )
else
{
psDroid = (DROID*)psSample->psObj;
ASSERT( PTRVALID(psDroid, sizeof(DROID)),
ASSERT( psDroid != NULL,
"unitCheckBuildStillInProgress: unit pointer invalid\n" );
}
@ -1612,14 +1612,14 @@ droidBuildStartAudioCallback( AUDIO_SAMPLE *psSample )
{
DROID *psDroid;
ASSERT( PTRVALID(psSample, sizeof(AUDIO_SAMPLE)),
ASSERT( psSample != NULL,
"unitBuildStartAudioCallback: audio sample pointer invalid\n" );
psDroid = (DROID*)psSample->psObj;
if ( psDroid != NULL )
{
ASSERT( PTRVALID(psDroid, sizeof(DROID)),
ASSERT( psDroid != NULL,
"unitBuildStartAudioCallback: unit pointer invalid\n" );
if ( psDroid->visible[selectedPlayer] )
@ -1641,7 +1641,7 @@ BOOL droidStartBuild(DROID *psDroid)
STRUCTURE_STATS *psStructStat;
//MESSAGE *psMessage;
ASSERT( PTRVALID(psDroid, sizeof(DROID)),
ASSERT( psDroid != NULL,
"unitStartBuild: invalid unit pointer" );
/* See if we are starting a new structure */
@ -5687,9 +5687,9 @@ BOOL buildModule(DROID *psDroid, STRUCTURE *psStruct,BOOL bCheckPower)
BOOL order;
UDWORD i=0;
// ASSERT( PTRVALID(psDroid, sizeof(DROID)),
// ASSERT( psDroid != NULL,
// "buildModule: Invalid droid pointer" );
ASSERT( PTRVALID(psStruct, sizeof(STRUCTURE)),
ASSERT( psStruct != NULL,
"buildModule: Invalid structure pointer" );
order = FALSE;
@ -5908,7 +5908,7 @@ BOOL electronicDroid(DROID *psDroid)
{
DROID *psCurr;
ASSERT( PTRVALID(psDroid, sizeof(DROID)),
ASSERT( psDroid != NULL,
"electronicUnit: Invalid unit pointer" );
//Watermelon:use slot 0 for now
@ -5939,7 +5939,7 @@ BOOL droidUnderRepair(DROID *psDroid)
{
DROID *psCurr;
ASSERT( PTRVALID(psDroid, sizeof(DROID)),
ASSERT( psDroid != NULL,
"unitUnderRepair: Invalid unit pointer" );
//droid must be damaged
@ -6624,7 +6624,7 @@ BOOL checkValidWeaponForProp(DROID_TEMPLATE *psTemplate)
bValid = TRUE;
//check propulsion stat for vtol
psPropStats = asPropulsionStats + psTemplate->asParts[COMP_PROPULSION];
ASSERT( PTRVALID(psPropStats, sizeof(PROPULSION_STATS)),
ASSERT( psPropStats != NULL,
"checkValidWeaponForProp: invalid propulsion stats pointer" );
if (asPropulsionTypes[psPropStats->propulsionType].travel == AIR)
{
@ -6796,7 +6796,7 @@ BOOL droidAudioTrackStopped( AUDIO_SAMPLE *psSample )
{
DROID *psDroid;
ASSERT( PTRVALID(psSample, sizeof(AUDIO_SAMPLE)),
ASSERT( psSample != NULL,
"unitAudioTrackStopped: audio sample pointer invalid\n" );
if ( psSample->psObj != NULL )
@ -6805,7 +6805,7 @@ BOOL droidAudioTrackStopped( AUDIO_SAMPLE *psSample )
if ( psDroid->type == OBJ_DROID && !psDroid->died )
{
ASSERT( PTRVALID(psDroid, sizeof(DROID)),
ASSERT( psDroid != NULL,
"unitAudioTrackStopped: unit pointer invalid\n" );
psDroid->iAudioID = NO_SOUND;
}

View File

@ -644,7 +644,7 @@ BOOL featureDamage(FEATURE *psFeature, UDWORD damage, UDWORD weaponSubClass)
/* this is ignored for features */
//(void)weaponClass;
ASSERT( PTRVALID(psFeature, sizeof(FEATURE)),
ASSERT( psFeature != NULL,
"featureDamage: Invalid feature pointer" );
debug( LOG_ATTACK, "featureDamage(%d): body %d armour %d damage: %d\n",
@ -962,7 +962,7 @@ void removeFeature(FEATURE *psDel)
// UWORD uwFlameCycles, uwFlameAnims, i;
// UDWORD x, y, udwFlameDelay;
ASSERT( PTRVALID(psDel, sizeof(FEATURE)),
ASSERT( psDel != NULL,
"removeFeature: invalid feature pointer\n" );
if (psDel->died)
@ -1061,7 +1061,7 @@ void destroyFeature(FEATURE *psDel)
UDWORD texture;
ASSERT( PTRVALID(psDel, sizeof(FEATURE)),
ASSERT( psDel != NULL,
"destroyFeature: invalid feature pointer\n" );
//---------------------------------------------------------------------------------------

View File

@ -258,7 +258,7 @@ void formationJoin(FORMATION *psFormation, BASE_OBJECT *psObj)
{
SDWORD rankDist, size;
ASSERT( PTRVALID(psFormation, sizeof(FORMATION)),
ASSERT( psFormation != NULL,
"formationJoin: invalid formation" );
// debug( LOG_NEVER, "formationJoin: %p, obj %d\n", psFormation, psObj->id );
@ -289,7 +289,7 @@ void formationLeave(FORMATION *psFormation, BASE_OBJECT *psObj)
F_MEMBER *asMembers;
FORMATION *psCurr, *psPrev;
ASSERT( PTRVALID(psFormation, sizeof(FORMATION)),
ASSERT( psFormation != NULL,
"formationLeave: invalid formation" );
ASSERT( psFormation->refCount > 0,
"formationLeave: refcount is zero" );
@ -768,7 +768,7 @@ BOOL formationGetPos( FORMATION *psFormation, BASE_OBJECT *psObj,
SDWORD member, x,y;
F_MEMBER *asMembers;
ASSERT( PTRVALID(psFormation, sizeof(FORMATION)),
ASSERT( psFormation != NULL,
"formationGetPos: invalid formation pointer" );
/* if (psFormation->refCount == 1)

View File

@ -228,9 +228,9 @@ BOOL fpathLiftBlockingTile(SDWORD x, SDWORD y)
SDWORD iLiftHeight, iBlockingHeight;
DROID *psDroid = (DROID *) g_psObjRoute;
ASSERT( PTRVALID(g_psObjRoute, sizeof(BASE_OBJECT)),
ASSERT( g_psObjRoute != NULL,
"fpathLiftBlockingTile: invalid object pointer" );
ASSERT( PTRVALID(psDroid, sizeof(DROID)),
ASSERT( psDroid != NULL,
"fpathLiftBlockingTile: invalid droid pointer" );
if (psDroid->droidType == DROID_TRANSPORTER )
@ -425,7 +425,7 @@ void fpathSetDirectRoute( BASE_OBJECT *psObj, SDWORD targetX, SDWORD targetY )
{
MOVE_CONTROL *psMoveCntl;
ASSERT( PTRVALID(psObj, sizeof(BASE_OBJECT)),
ASSERT( psObj != NULL,
"fpathSetDirectRoute: invalid object pointer\n" );
if ( psObj->type == OBJ_DROID )
@ -1346,7 +1346,7 @@ FPATH_RETVAL fpathRoute(BASE_OBJECT *psObj, MOVE_CONTROL *psMoveCntl,
{
psDroid = (DROID *)psObj;
psPropStats = asPropulsionStats + psDroid->asBits[COMP_PROPULSION].nStat;
ASSERT( PTRVALID(psPropStats, sizeof(PROPULSION_STATS)),
ASSERT( psPropStats != NULL,
"fpathRoute: invalid propulsion stats pointer" );
fpathSetBlockingTile( psPropStats->propulsionType );

View File

@ -1761,11 +1761,11 @@ void structureProductionUpgrade(STRUCTURE *psBuilding)
//upgrade the Output
pFact = (FACTORY*)psBuilding->pFunctionality;
ASSERT( PTRVALID(pFact, sizeof(FACTORY)),
ASSERT( pFact != NULL,
"structureProductionUpgrade: invalid Factory pointer" );
pFactFunc = (PRODUCTION_FUNCTION *)psBuilding->pStructureType->asFuncList[0];
ASSERT( PTRVALID(pFactFunc, sizeof(PRODUCTION_FUNCTION)),
ASSERT( pFactFunc != NULL,
"structureProductionUpgrade: invalid Function pointer" );
//current base value depends on whether there are modules attached to the structure
@ -1792,11 +1792,11 @@ void structureResearchUpgrade(STRUCTURE *psBuilding)
//upgrade the research points
pRes = (RESEARCH_FACILITY*)psBuilding->pFunctionality;
ASSERT( PTRVALID(pRes, sizeof(RESEARCH_FACILITY)),
ASSERT( pRes != NULL,
"structureResearchUpgrade: invalid Research pointer" );
pResFunc = (RESEARCH_FUNCTION *)psBuilding->pStructureType->asFuncList[0];
ASSERT( PTRVALID(pResFunc, sizeof(RESEARCH_FUNCTION)),
ASSERT( pResFunc != NULL,
"structureResearchUpgrade: invalid Function pointer" );
//current base value depends on whether there are modules attached to the structure
@ -1820,11 +1820,11 @@ void structureReArmUpgrade(STRUCTURE *psBuilding)
//upgrade the reArm points
pPad = (REARM_PAD*)psBuilding->pFunctionality;
ASSERT( PTRVALID(pPad, sizeof(REARM_PAD)),
ASSERT( pPad != NULL,
"structureReArmUpgrade: invalid ReArm pointer" );
pPadFunc = (REARM_FUNCTION *)psBuilding->pStructureType->asFuncList[0];
ASSERT( PTRVALID(pPadFunc, sizeof(REARM_FUNCTION)),
ASSERT( pPadFunc != NULL,
"structureReArmUpgrade: invalid Function pointer" );
pPad->reArmPoints = pPadFunc->reArmPoints + (pPadFunc->reArmPoints *
@ -1840,11 +1840,11 @@ void structurePowerUpgrade(STRUCTURE *psBuilding)
//upgrade the research points
pPowerGen = (POWER_GEN*)psBuilding->pFunctionality;
ASSERT( PTRVALID(pPowerGen, sizeof(POWER_GEN)),
ASSERT( pPowerGen != NULL,
"structurePowerUpgrade: invalid Power Gen pointer" );
pPGFunc = (POWER_GEN_FUNCTION *)psBuilding->pStructureType->asFuncList[0];
ASSERT( PTRVALID(pPGFunc, sizeof(POWER_GEN_FUNCTION)),
ASSERT( pPGFunc != NULL,
"structurePowerUpgrade: invalid Function pointer" );
//current base value depends on whether there are modules attached to the structure
@ -1868,11 +1868,11 @@ void structureRepairUpgrade(STRUCTURE *psBuilding)
//upgrade the research points
pRepair = (REPAIR_FACILITY*)psBuilding->pFunctionality;
ASSERT( PTRVALID(pRepair, sizeof(REPAIR_FACILITY)),
ASSERT( pRepair != NULL,
"structureRepairUpgrade: invalid Repair pointer" );
pRepairFunc = (REPAIR_DROID_FUNCTION *)psBuilding->pStructureType->asFuncList[0];
ASSERT( PTRVALID(pRepairFunc, sizeof(REPAIR_DROID_FUNCTION)),
ASSERT( pRepairFunc != NULL,
"structureRepairUpgrade: invalid Function pointer" );
pRepair->power = pRepairFunc->repairPoints + (pRepairFunc->repairPoints *

View File

@ -4499,7 +4499,7 @@ BOOL loadSaveDroidInitV2(char *pFileData, UDWORD filesize,UDWORD quantity)
}
else
{
ASSERT( PTRVALID(psTemplate, sizeof(DROID_TEMPLATE)),
ASSERT( psTemplate != NULL,
"loadSaveUnitInitV2: Invalid template pointer" );
// Need to set apCompList[pDroidInit->player][componenttype][compid] = AVAILABLE for each droid.

View File

@ -82,7 +82,7 @@ void grpJoin(DROID_GROUP *psGroup, DROID *psDroid)
{
psGroup->refCount += 1;
ASSERT( PTRVALID(psGroup, sizeof(DROID_GROUP)),
ASSERT( psGroup != NULL,
"grpJoin: invalid group pointer" );
// if psDroid == NULL just increase the refcount don't add anything to the list
@ -133,7 +133,7 @@ void grpJoinEnd(DROID_GROUP *psGroup, DROID *psDroid)
psGroup->refCount += 1;
ASSERT( PTRVALID(psGroup, sizeof(DROID_GROUP)),
ASSERT( psGroup != NULL,
"grpJoin: invalid group pointer" );
// if psDroid == NULL just increase the refcount don't add anything to the list
@ -186,7 +186,7 @@ void grpLeave(DROID_GROUP *psGroup, DROID *psDroid)
{
DROID *psPrev, *psCurr;
ASSERT( PTRVALID(psGroup, sizeof(DROID_GROUP)),
ASSERT( psGroup != NULL,
"grpLeave: invalid group pointer" );
if ( (psDroid != NULL )
@ -258,7 +258,7 @@ SDWORD grpNumMembers(DROID_GROUP *psGroup)
DROID *psCurr;
SDWORD num;
ASSERT( PTRVALID(psGroup, sizeof(DROID_GROUP)),
ASSERT( psGroup != NULL,
"grpNumMembers: invalid droid group" );
num = 0;
@ -276,7 +276,7 @@ void grpReset(DROID_GROUP *psGroup)
{
DROID *psCurr, *psNext;
ASSERT( PTRVALID(psGroup, sizeof(DROID_GROUP)),
ASSERT( psGroup != NULL,
"grpReset: invalid droid group" );
for(psCurr = psGroup->psList; psCurr; psCurr = psNext)
@ -292,7 +292,7 @@ void grpReset(DROID_GROUP *psGroup)
// DROID *psCurr;
// BOOL usedgrouporder=FALSE;
// ASSERT( PTRVALID(psGroup, sizeof(DROID_GROUP)),
// ASSERT( psGroup != NULL,
// "orderGroupBase: invalid droid group" );
//
// if (bMultiPlayer && SendGroupOrder( psGroup, psData->x, psData->y, psData->psObj) )
@ -317,7 +317,7 @@ void orderGroup(DROID_GROUP *psGroup, DROID_ORDER order)
{
DROID *psCurr;
ASSERT( PTRVALID(psGroup, sizeof(DROID_GROUP)),
ASSERT( psGroup != NULL,
"orderGroup: invalid droid group" );
for (psCurr = psGroup->psList; psCurr; psCurr=psCurr->psGrpNext)
@ -331,7 +331,7 @@ void orderGroupLoc(DROID_GROUP *psGroup, DROID_ORDER order, UDWORD x, UDWORD y)
{
DROID *psCurr;
ASSERT( PTRVALID(psGroup, sizeof(DROID_GROUP)),
ASSERT( psGroup != NULL,
"orderGroupLoc: invalid droid group" );
if(bMultiPlayer)
@ -362,7 +362,7 @@ void orderGroupObj(DROID_GROUP *psGroup, DROID_ORDER order, BASE_OBJECT *psObj)
DROID *psCurr;
DROID_OACTION_INFO oaInfo = {{(BASE_OBJECT *)psObj}};
ASSERT( PTRVALID(psGroup, sizeof(DROID_GROUP)),
ASSERT( psGroup != NULL,
"orderGroupObj: invalid droid group" );
if(bMultiPlayer)
@ -391,7 +391,7 @@ void grpSetSecondary(DROID_GROUP *psGroup, SECONDARY_ORDER sec, SECONDARY_STATE
{
DROID *psCurr;
ASSERT( PTRVALID(psGroup, sizeof(DROID_GROUP)),
ASSERT( psGroup != NULL,
"grpSetSecondary: invalid droid group" );
for(psCurr = psGroup->psList; psCurr; psCurr = psCurr->psGrpNext)

View File

@ -2862,9 +2862,9 @@ static void intProcessStats(UDWORD id)
{
//get the stats
psStats = ppsStatsList[id - IDSTAT_START];
ASSERT( PTRVALID(psObjSelected, sizeof(STRUCTURE)),
ASSERT( psObjSelected != NULL,
"intProcessStats: Invalid structure pointer" );
ASSERT( PTRVALID(psStats, sizeof(DROID_TEMPLATE)),
ASSERT( psStats != NULL,
"intProcessStats: Invalid template pointer" );
if (productionPlayer == (SBYTE)selectedPlayer)
{
@ -3496,7 +3496,7 @@ void intBuildFinished(DROID *psDroid)
UDWORD droidID;
DROID *psCurr;
ASSERT( PTRVALID(psDroid, sizeof(DROID)),
ASSERT( psDroid != NULL,
"intBuildFinished: Invalid droid pointer" );
if ((intMode == INT_OBJECT || intMode == INT_STAT) &&
@ -3526,7 +3526,7 @@ void intBuildStarted(DROID *psDroid)
UDWORD droidID;
DROID *psCurr;
ASSERT( PTRVALID(psDroid, sizeof(DROID)),
ASSERT( psDroid != NULL,
"intBuildStarted: Invalid droid pointer" );
if ((intMode == INT_OBJECT || intMode == INT_STAT) &&
@ -3711,7 +3711,7 @@ void intManufactureFinished(STRUCTURE *psBuilding)
STRUCTURE *psCurr;
BASE_OBJECT *psObj;
ASSERT( PTRVALID(psBuilding, sizeof(STRUCTURE)),
ASSERT( psBuilding != NULL,
"intManufactureFinished: Invalid structure pointer" );
if ((intMode == INT_OBJECT || intMode == INT_STAT) &&
@ -3765,7 +3765,7 @@ void intResearchFinished(STRUCTURE *psBuilding)
//STRUCTURE *psCurr;
//BASE_OBJECT *psObj;
ASSERT( PTRVALID(psBuilding, sizeof(STRUCTURE)),
ASSERT( psBuilding != NULL,
"intResearchFinished: Invalid structure pointer" );
// just do a screen refresh
@ -4385,9 +4385,6 @@ static BOOL intAddObjectWindow(BASE_OBJECT *psObjects, BASE_OBJECT *psSelected,B
BOOL Animate = TRUE;
UWORD FormX,FormY;
ASSERT( psSelected == NULL || PTRVALID(psSelected, sizeof(BASE_OBJECT)),
"intAddObject: Invalid object pointer" );
// Is the form already up?
if(widgGetFromID(psWScreen,IDOBJ_FORM) != NULL) {
intRemoveObjectNoAnim();
@ -6116,7 +6113,7 @@ static BOOL selectCommand(BASE_OBJECT *psObj)
// UDWORD i;
DROID *psDroid;
ASSERT( PTRVALID(psObj, sizeof(DROID)) && psObj->type == OBJ_DROID,
ASSERT( psObj != NULL && psObj->type == OBJ_DROID,
"selectConstruction: invalid droid pointer" );
psDroid = (DROID *)psObj;
@ -6154,7 +6151,7 @@ static BOOL selectConstruction(BASE_OBJECT *psObj)
// UDWORD i;
DROID *psDroid;
ASSERT( PTRVALID(psObj, sizeof(DROID)) && psObj->type == OBJ_DROID,
ASSERT( psObj != NULL && psObj->type == OBJ_DROID,
"selectConstruction: invalid droid pointer" );
psDroid = (DROID *)psObj;
@ -6184,7 +6181,7 @@ static BASE_STATS *getConstructionStats(BASE_OBJECT *psObj)
STRUCTURE *Structure;
UDWORD x,y;
ASSERT( PTRVALID(psObj, sizeof(DROID)) && psObj->type == OBJ_DROID,
ASSERT( psObj != NULL && psObj->type == OBJ_DROID,
"getConstructionStats: invalid droid pointer" );
psDroid = (DROID *)psObj;
@ -6221,11 +6218,9 @@ static BOOL setConstructionStats(BASE_OBJECT *psObj, BASE_STATS *psStats)
//UDWORD i;
DROID *psDroid;
ASSERT( PTRVALID(psObj, sizeof(DROID)) && psObj->type == OBJ_DROID,
ASSERT( psObj != NULL && psObj->type == OBJ_DROID,
"setConstructionStats: invalid droid pointer" );
/* psStats might be NULL if the operation is canceled in the middle */
ASSERT( psStats == NULL || PTRVALID(psStats, sizeof(STRUCTURE_STATS)),
"setConstructionStats: invalid stats pointer" );
if (psStats != NULL)
{
@ -6320,7 +6315,7 @@ static BOOL selectResearch(BASE_OBJECT *psObj)
{
STRUCTURE *psResFacility;
ASSERT( PTRVALID(psObj, sizeof(STRUCTURE)) && psObj->type == OBJ_STRUCTURE,
ASSERT( psObj != NULL && psObj->type == OBJ_STRUCTURE,
"selectResearch: invalid Structure pointer" );
psResFacility = (STRUCTURE *)psObj;
@ -6340,7 +6335,7 @@ static BASE_STATS *getResearchStats(BASE_OBJECT *psObj)
{
STRUCTURE *psBuilding;
ASSERT( PTRVALID(psObj, sizeof(STRUCTURE)) && psObj->type == OBJ_STRUCTURE,
ASSERT( psObj != NULL && psObj->type == OBJ_STRUCTURE,
"getResearchTip: invalid Structure pointer" );
psBuilding = (STRUCTURE *)psObj;
@ -6357,11 +6352,9 @@ static BOOL setResearchStats(BASE_OBJECT *psObj, BASE_STATS *psStats)
UDWORD count;
RESEARCH_FACILITY *psResFacilty;
ASSERT( PTRVALID(psObj, sizeof(STRUCTURE)) && psObj->type == OBJ_STRUCTURE,
ASSERT( psObj != NULL && psObj->type == OBJ_STRUCTURE,
"setResearchStats: invalid Structure pointer" );
/* psStats might be NULL if the operation is canceled in the middle */
ASSERT( psStats == NULL || PTRVALID(psStats, sizeof(RESEARCH)),
"setResearchStats: invalid stats pointer" );
psBuilding = (STRUCTURE *)psObj;
psResFacilty = (RESEARCH_FACILITY*)psBuilding->pFunctionality;
@ -6426,7 +6419,7 @@ static BOOL selectManufacture(BASE_OBJECT *psObj)
{
STRUCTURE *psBuilding;
ASSERT( PTRVALID(psObj, sizeof(STRUCTURE)) && psObj->type == OBJ_STRUCTURE,
ASSERT( psObj != NULL && psObj->type == OBJ_STRUCTURE,
"selectManufacture: invalid Structure pointer" );
psBuilding = (STRUCTURE *)psObj;
@ -6448,7 +6441,7 @@ static BASE_STATS *getManufactureStats(BASE_OBJECT *psObj)
{
STRUCTURE *psBuilding;
ASSERT( PTRVALID(psObj, sizeof(STRUCTURE)) && psObj->type == OBJ_STRUCTURE,
ASSERT( psObj != NULL && psObj->type == OBJ_STRUCTURE,
"getManufactureTip: invalid Structure pointer" );
psBuilding = (STRUCTURE *)psObj;
@ -6461,11 +6454,9 @@ static BOOL setManufactureStats(BASE_OBJECT *psObj, BASE_STATS *psStats)
{
STRUCTURE *Structure;
ASSERT( PTRVALID(psObj, sizeof(STRUCTURE)) && psObj->type == OBJ_STRUCTURE,
ASSERT( psObj != NULL && psObj->type == OBJ_STRUCTURE,
"setManufactureStats: invalid Structure pointer" );
/* psStats might be NULL if the operation is canceled in the middle */
ASSERT( psStats == NULL || PTRVALID(psStats, sizeof(DROID_TEMPLATE)),
"setManufactureStats: invalid stats pointer" );
#ifdef INCLUDE_FACTORYLISTS
Structure = (STRUCTURE*)psObj;
@ -6680,9 +6671,9 @@ static void intStatsRMBPressed(UDWORD id)
//this now causes the production run to be decreased by one
#ifdef INCLUDE_FACTORYLISTS
ASSERT( PTRVALID(psObjSelected, sizeof(STRUCTURE)),
ASSERT( psObjSelected != NULL,
"intStatsRMBPressed: Invalid structure pointer" );
ASSERT( PTRVALID(psStats, sizeof(DROID_TEMPLATE)),
ASSERT( psStats != NULL,
"intStatsRMBPressed: Invalid template pointer" );
if (productionPlayer == (SBYTE)selectedPlayer)
{

View File

@ -1078,7 +1078,7 @@ init_ObjectDead( void * psObj )
STRUCTURE *psStructure;
/* check is valid pointer */
ASSERT( PTRVALID(psBaseObj, sizeof(BASE_OBJECT)),
ASSERT( psBaseObj != NULL,
"init_ObjectDead: game object pointer invalid\n" );
if ( psBaseObj->died == TRUE )

View File

@ -469,7 +469,7 @@ void intAddFactoryInc(WIDGET *psWidget, W_CONTEXT *psContext)
psObj = (BASE_OBJECT*)Label->pUserData;
if (psObj != NULL)
{
ASSERT( PTRVALID(psObj, sizeof(STRUCTURE)) && psObj->type == OBJ_STRUCTURE,
ASSERT( psObj != NULL,
"intAddFactoryInc: invalid structure pointer" );
ASSERT( !psObj->died,"intAddFactoryInc: object is dead" );
@ -507,7 +507,7 @@ void intAddProdQuantity(WIDGET *psWidget, W_CONTEXT *psContext)
psStat = (BASE_STATS *)Label->pUserData;
if (psStat != NULL)
{
ASSERT( PTRVALID(psStat, sizeof(DROID_TEMPLATE)),
ASSERT( psStat != NULL,
"intAddProdQuantity: invalid template pointer" );
psTemplate = (DROID_TEMPLATE *)psStat;
@ -590,7 +590,7 @@ void intUpdateCommandSize(WIDGET *psWidget, W_CONTEXT *psContext)
psObj = (BASE_OBJECT*)Label->pUserData;
if (psObj != NULL)
{
ASSERT( PTRVALID(psObj, sizeof(DROID)) && psObj->type == OBJ_DROID,
ASSERT( psObj != NULL,
"intUpdateCommandSize: invalid droid pointer" );
ASSERT( !psObj->died,"intUpdateCommandSize: droid has died" );
@ -622,7 +622,7 @@ void intUpdateCommandExp(WIDGET *psWidget, W_CONTEXT *psContext)
psObj = (BASE_OBJECT*)Label->pUserData;
if (psObj != NULL)
{
ASSERT( PTRVALID(psObj, sizeof(DROID)) && psObj->type == OBJ_DROID,
ASSERT( psObj != NULL && psObj->type == OBJ_DROID,
"intUpdateCommandSize: invalid droid pointer" );
ASSERT( !psObj->died,"intUpdateCommandSize: droid has died" );
@ -660,7 +660,7 @@ void intUpdateCommandFact(WIDGET *psWidget, W_CONTEXT *psContext)
psObj = (BASE_OBJECT*)Label->pUserData;
if (psObj != NULL)
{
ASSERT( PTRVALID(psObj, sizeof(DROID)) && psObj->type == OBJ_DROID,
ASSERT( psObj != NULL && psObj->type == OBJ_DROID,
"intUpdateCommandSize: invalid droid pointer" );
ASSERT( !psObj->died,"intUpdateCommandSize: droid has died" );
@ -3532,7 +3532,7 @@ void intDisplayTransportButton(WIDGET *psWidget, UDWORD xOffset,
//allocate this outside of the if so the rank icons are always draw
psDroid = (DROID*)Buffer->Data;
//there should always be a droid associated with the button
ASSERT( PTRVALID(psDroid, sizeof(DROID)),
ASSERT( psDroid != NULL,
"intDisplayTransportButton: invalid droid pointer" );
{
@ -3550,7 +3550,7 @@ void intDisplayTransportButton(WIDGET *psWidget, UDWORD xOffset,
//psDroid = (DROID*)Buffer->Data;
//there should always be a droid associated with the button
//ASSERT( PTRVALID(psDroid, sizeof(DROID)),
//ASSERT( psDroid != NULL,
// "intDisplayTransportButton: invalid droid pointer" );
if (psDroid)

View File

@ -962,7 +962,7 @@ static void StartMessageSequences(MESSAGE *psMessage, BOOL Start)
return;
}
ASSERT( PTRVALID(psMessage->pViewData, sizeof(VIEWDATA)),
ASSERT( psMessage->pViewData != NULL,
"StartMessageSequences: invalid ViewData pointer" );
if (((VIEWDATA *)psMessage->pViewData)->type == VIEW_RPL)

View File

@ -2081,7 +2081,7 @@ DROID *psDroid;
if(!psDroid->selected)
{
psPropStats = asPropulsionStats + psDroid->asBits[COMP_PROPULSION].nStat;
ASSERT( PTRVALID(psPropStats, sizeof(PROPULSION_STATS)),
ASSERT( psPropStats != NULL,
"moveUpdateDroid: invalid propulsion stats pointer" );
if ( psPropStats->propulsionType == propType )
{

View File

@ -115,7 +115,7 @@ extern UDWORD selectedPlayer;
* Order is now CAMPAIGN, MISSION, RESEARCH/PROXIMITY
*/
#define ADD_MSG(list, msg, player) \
ASSERT( PTRVALID((msg), sizeof(MESSAGE)), \
ASSERT( msg != NULL, \
"addMessage: Invalid message pointer" ); \
if (list[player] == NULL) \
{ \
@ -161,7 +161,7 @@ extern UDWORD selectedPlayer;
static void add_msg(MESSAGE *list[MAX_PLAYERS], MESSAGE *msg, UDWORD player)
{
ASSERT( PTRVALID((msg), sizeof(MESSAGE)),
ASSERT( msg != NULL,
"addMessage: Invalid message pointer" );
if (list[player] == NULL)
{
@ -248,7 +248,7 @@ static void add_msg(MESSAGE *list[MAX_PLAYERS], MESSAGE *msg, UDWORD player)
* del is a pointer to the message to remove
*/
#define REMOVEMSG(list, heap, del, player) \
ASSERT( PTRVALID(del, sizeof(MESSAGE)), \
ASSERT( del != NULL, \
"removeMessage: Invalid message pointer" ); \
if (list[player] == del) \
{ \

View File

@ -2023,7 +2023,7 @@ void aiUpdateMissionStructure(STRUCTURE *psStructure)
DROID_TEMPLATE *psNextTemplate;
#endif
ASSERT( PTRVALID(psStructure, sizeof(STRUCTURE)),
ASSERT( psStructure != NULL,
"aiUpdateMissionStructure: invalid Structure pointer" );
ASSERT( (psStructure->pStructureType->type == REF_FACTORY ||
@ -2290,7 +2290,7 @@ void aiUpdateMissionStructure(STRUCTURE *psStructure)
void missionStructureUpdate(STRUCTURE *psBuilding)
{
ASSERT( PTRVALID(psBuilding, sizeof(STRUCTURE)),
ASSERT( psBuilding != NULL,
"structureUpdate: Invalid Structure pointer" );
//update the manufacture/research of the building
@ -2312,7 +2312,7 @@ void missionStructureUpdate(STRUCTURE *psBuilding)
Only interested in Transporters at present*/
void missionDroidUpdate(DROID *psDroid)
{
ASSERT( PTRVALID(psDroid, sizeof(DROID)),
ASSERT( psDroid != NULL,
"unitUpdate: Invalid unit pointer" );
/*This is required for Transporters that are moved offWorld so the
@ -3156,7 +3156,7 @@ void intUpdateTransporterTimer(WIDGET *psWidget, W_CONTEXT *psContext)
psTransporter = (DROID *)Label->pUserData;
if (psTransporter != NULL)
{
ASSERT( PTRVALID(psTransporter, sizeof(DROID)),
ASSERT( psTransporter != NULL,
"intUpdateTransporterTimer: invalid Droid pointer" );
if (psTransporter->action == DACTION_TRANSPORTIN ||

View File

@ -377,7 +377,7 @@ static BOOL _moveDroidToBase(DROID *psDroid, UDWORD x, UDWORD y, BOOL bFormation
FPATH_RETVAL retVal = FPR_OK;
SDWORD fmx1,fmy1, fmx2,fmy2;
ASSERT( PTRVALID(psDroid, sizeof(DROID)),
ASSERT( psDroid != NULL,
"moveUnitTo: Invalid unit pointer" );
@ -569,7 +569,7 @@ BOOL moveDroidToNoFormation(DROID *psDroid, UDWORD x,UDWORD y)
// move a droid directly to a location (used by vtols only)
void moveDroidToDirect(DROID *psDroid, UDWORD x, UDWORD y)
{
ASSERT( PTRVALID(psDroid, sizeof(DROID)) && vtolDroid(psDroid),
ASSERT( psDroid != NULL && vtolDroid(psDroid),
"moveUnitToDirect: only valid for a vtol unit" );
fpathSetDirectRoute((BASE_OBJECT *)psDroid, (SDWORD)x, (SDWORD)y);
@ -808,11 +808,11 @@ void moveStopDroid(DROID *psDroid)
{
PROPULSION_STATS *psPropStats;
ASSERT( PTRVALID(psDroid, sizeof(DROID)),
ASSERT( psDroid != NULL,
"moveStopUnit: Invalid unit pointer" );
psPropStats = asPropulsionStats + psDroid->asBits[COMP_PROPULSION].nStat;
ASSERT( PTRVALID(psPropStats, sizeof(PROPULSION_STATS)),
ASSERT( psPropStats != NULL,
"moveUpdateUnit: invalid propulsion stats pointer" );
if ( psPropStats->propulsionType == LIFT )
@ -828,7 +828,7 @@ void moveStopDroid(DROID *psDroid)
/*Stops a droid dead in its tracks - doesn't allow for any little skidding bits*/
void moveReallyStopDroid(DROID *psDroid)
{
ASSERT( PTRVALID(psDroid, sizeof(DROID)),
ASSERT( psDroid != NULL,
"moveReallyStopUnit: invalid unit pointer" );
psDroid->sMove.Status = MOVEINACTIVE;
@ -1905,7 +1905,7 @@ static void moveGetObstVector4(DROID *psDroid, FRACT *pX, FRACT *pY)
PROPULSION_STATS *psPropStats;
psPropStats = asPropulsionStats + psDroid->asBits[COMP_PROPULSION].nStat;
ASSERT( PTRVALID(psPropStats, sizeof(PROPULSION_STATS)),
ASSERT( psPropStats != NULL,
"moveUpdateUnit: invalid propulsion stats pointer" );
numObst = 0;
@ -3062,7 +3062,7 @@ moveCyborgLaunchAnimDone( ANIM_OBJECT *psObj )
{
DROID *psDroid = psObj->psParent;
ASSERT( PTRVALID(psDroid, sizeof(DROID)),
ASSERT( psDroid != NULL,
"moveCyborgLaunchAnimDone: invalid cyborg pointer" );
/* raise cyborg a little bit so flying - terrible hack - GJ */
@ -3077,7 +3077,7 @@ moveCyborgTouchDownAnimDone( ANIM_OBJECT *psObj )
{
DROID *psDroid = psObj->psParent;
ASSERT( PTRVALID(psDroid, sizeof(DROID)),
ASSERT( psDroid != NULL,
"moveCyborgTouchDownAnimDone: invalid cyborg pointer" );
psDroid->psCurAnim = NULL;
@ -3138,7 +3138,7 @@ moveUpdateCyborgModel( DROID *psDroid, SDWORD moveSpeed, SDWORD moveDir, UBYTE o
}
psPropStats = asPropulsionStats + psDroid->asBits[COMP_PROPULSION].nStat;
ASSERT( PTRVALID(psPropStats, sizeof(PROPULSION_STATS)),
ASSERT( psPropStats != NULL,
"moveUpdateCyborgModel: invalid propulsion stats pointer" );
/* do vertical movement */
@ -3295,7 +3295,7 @@ BOOL moveCheckDroidMovingAndVisible( AUDIO_SAMPLE *psSample )
{
DROID *psDroid;
ASSERT( PTRVALID(psSample, sizeof(AUDIO_SAMPLE)),
ASSERT( psSample != NULL,
"moveCheckUnitMovingAndVisible: audio sample pointer invalid\n" );
if ( psSample->psObj == NULL )
@ -3305,7 +3305,7 @@ BOOL moveCheckDroidMovingAndVisible( AUDIO_SAMPLE *psSample )
else
{
psDroid = psSample->psObj;
ASSERT( PTRVALID(psDroid, sizeof(DROID)),
ASSERT( psDroid != NULL,
"moveCheckUnitMovingAndVisible: unit pointer invalid\n" );
}
@ -3331,7 +3331,7 @@ static void movePlayDroidMoveAudio( DROID *psDroid )
PROPULSION_TYPES *psPropType;
UBYTE iPropType = 0;
ASSERT( PTRVALID(psDroid, sizeof(DROID)),
ASSERT( psDroid != NULL,
"movePlayUnitMoveAudio: unit pointer invalid\n" );
if ( (psDroid != NULL) &&
@ -3376,7 +3376,7 @@ static BOOL moveDroidStartCallback( AUDIO_SAMPLE *psSample )
{
DROID *psDroid;
ASSERT( PTRVALID(psSample, sizeof(AUDIO_SAMPLE)),
ASSERT( psSample != NULL,
"moveUnitStartCallback: audio sample pointer invalid\n" );
if ( psSample->psObj == NULL )
@ -3386,7 +3386,7 @@ static BOOL moveDroidStartCallback( AUDIO_SAMPLE *psSample )
else
{
psDroid = psSample->psObj;
ASSERT( PTRVALID(psDroid, sizeof(DROID)),
ASSERT( psDroid != NULL,
"moveDroidStartCallback: unit pointer invalid\n" );
}
@ -3411,7 +3411,7 @@ static void movePlayAudio( DROID *psDroid, BOOL bStarted, BOOL bStoppedBefore, S
/* get prop stats */
psPropStats = asPropulsionStats + psDroid->asBits[COMP_PROPULSION].nStat;
ASSERT( PTRVALID(psPropStats, sizeof(PROPULSION_STATS)),
ASSERT( psPropStats != NULL,
"moveUpdateUnit: invalid propulsion stats pointer" );
propType = psPropStats->propulsionType;
psPropType = &asPropulsionTypes[propType];
@ -3556,7 +3556,7 @@ void moveUpdateDroid(DROID *psDroid)
// "moveUpdateUnit: unit at (0,0)" );
psPropStats = asPropulsionStats + psDroid->asBits[COMP_PROPULSION].nStat;
ASSERT( PTRVALID(psPropStats, sizeof(PROPULSION_STATS)),
ASSERT( psPropStats != NULL,
"moveUpdateUnit: invalid propulsion stats pointer" );
// if(driveModeActive()) {

View File

@ -613,7 +613,7 @@ static void offscreenUpdate(DROID *psDroid,
// snap droid(if on ground) to terrain level at x,y.
psPropStats = asPropulsionStats + psDroid->asBits[COMP_PROPULSION].nStat;
ASSERT( PTRVALID(psPropStats, sizeof(PROPULSION_STATS)),"offscreenUpdate: invalid propulsion stats pointer" );
ASSERT( psPropStats != NULL, "offscreenUpdate: invalid propulsion stats pointer" );
if( psPropStats->propulsionType != LIFT ) // if not airborne.
{
psDroid->z = map_Height(psDroid->x, psDroid->y);

View File

@ -365,7 +365,7 @@ void objmemUpdate(void)
* list is a pointer to the object list
*/
#define ADD(list, objType, type) \
ASSERT( PTRVALID((objType), sizeof(type)), \
ASSERT( objType != NULL, \
"addObject: Invalid " #type " pointer" ); \
(objType)->psNext = list[(objType)->player]; \
list[(objType)->player] = (objType)
@ -378,7 +378,7 @@ void objmemUpdate(void)
* type is the type of the object
*/
#define _DESTROY(list, del, type) \
ASSERT( PTRVALID((del), sizeof(type)), \
ASSERT( del != NULL, \
"destroyObject: Invalid " #type " pointer" ); \
if (list[(del)->player] == (del)) \
{ \
@ -423,7 +423,7 @@ void objmemUpdate(void)
* type is the type of the object
*/
#define REMOVE(list, remove, type) \
ASSERT( PTRVALID((remove), sizeof(type)), \
ASSERT( remove != NULL, \
"removeObject: Invalid " #type " pointer" ); \
if (list[(remove)->player] == (remove)) \
{ \
@ -651,7 +651,7 @@ BOOL createFlagPosition(FLAG_POSITION **ppsNew, UDWORD player)
/* add the Flag Position to the Flag Position Lists */
void addFlagPosition(FLAG_POSITION *psFlagPosToAdd)
{
ASSERT( PTRVALID((psFlagPosToAdd), sizeof(FLAG_POSITION)),
ASSERT( psFlagPosToAdd != NULL,
"addFlagPosition: Invalid FlagPosition pointer" );
psFlagPosToAdd->psNext = apsFlagPosLists[psFlagPosToAdd->player];
@ -663,7 +663,7 @@ void removeFlagPosition(FLAG_POSITION *psDel)
{
FLAG_POSITION *psPrev=NULL, *psCurr;
ASSERT( PTRVALID((psDel), sizeof(FLAG_POSITION)),
ASSERT( psDel != NULL,
"removeFlagPosition: Invalid Flag Positionpointer" );
if (apsFlagPosLists[psDel->player] == psDel)

View File

@ -999,10 +999,10 @@ void orderUpdateDroid(DROID *psDroid)
{
/* get repair facility pointer */
psStruct = (STRUCTURE *) psDroid->psTarget[0];
ASSERT( PTRVALID(psStruct, sizeof(STRUCTURE)),
ASSERT( psStruct != NULL,
"orderUpdateUnit: invalid structure pointer" );
psRepairFac = (REPAIR_FACILITY *) psStruct->pFunctionality;
ASSERT( PTRVALID(psRepairFac, sizeof(REPAIR_FACILITY)),
ASSERT( psRepairFac != NULL,
"orderUpdateUnit: invalid repair facility pointer" );
xdiff = (SDWORD)psDroid->x - (SDWORD)psDroid->psTarget[0]->x;
@ -1387,7 +1387,7 @@ static void orderCmdGroupBase(DROID_GROUP *psGroup, DROID_ORDER_DATA *psData)
DROID *psCurr, *psChosen;
SDWORD xdiff,ydiff, currdist, mindist;
ASSERT( PTRVALID(psGroup, sizeof(DROID_GROUP)),
ASSERT( psGroup != NULL,
"cmdUnitOrderGroupBase: invalid unit group" );
@ -1549,7 +1549,7 @@ static void orderPlayFireSupportAudio( BASE_OBJECT *psObj )
{
case OBJ_DROID:
psDroid = (DROID *) psObj;
ASSERT( PTRVALID(psObj, sizeof(DROID)),
ASSERT( psObj != NULL,
"orderPlayFireSupportAudio: invalid droid pointer" );
if ( psDroid->droidType == DROID_COMMAND )
{
@ -1562,7 +1562,7 @@ static void orderPlayFireSupportAudio( BASE_OBJECT *psObj )
break;
case OBJ_STRUCTURE:
ASSERT( PTRVALID(psObj, sizeof(STRUCTURE)),
ASSERT( psObj != NULL,
"orderPlayFireSupportAudio: invalid structure pointer" );
psStruct = (STRUCTURE *) psObj;
//check for non-CB first
@ -1922,7 +1922,7 @@ void orderDroidBase(DROID *psDroid, DROID_ORDER_DATA *psOrder)
{
break;
}
ASSERT( PTRVALID(psOrder->psStats, sizeof(STRUCTURE_STATS)),
ASSERT( psOrder->psStats != NULL,
"orderUnitBase: invalid structure stats pointer" );
#if 0
// quick hack to get the droid to choose the location itself
@ -1998,7 +1998,7 @@ void orderDroidBase(DROID *psDroid, DROID_ORDER_DATA *psOrder)
{
break;
}
ASSERT( PTRVALID(psOrder->psStats, sizeof(STRUCTURE_STATS)),
ASSERT( psOrder->psStats != NULL,
"orderUnitBase: invalid structure stats pointer" );
psDroid->order = DORDER_LINEBUILD;
@ -2421,7 +2421,7 @@ void orderDroid(DROID *psDroid, DROID_ORDER order)
{
DROID_ORDER_DATA sOrder;
ASSERT( PTRVALID(psDroid, sizeof(DROID)),
ASSERT( psDroid != NULL,
"orderUnit: Invalid unit pointer" );
ASSERT( order == DORDER_NONE ||
order == DORDER_RETREAT ||
@ -2471,7 +2471,7 @@ void orderDroidLoc(DROID *psDroid, DROID_ORDER order, UDWORD x, UDWORD y)
// DBPRINTF(("droid=%p\n",psDroid);
// memMemoryReport(NULL);
ASSERT( PTRVALID(psDroid, sizeof(DROID)),
ASSERT( psDroid != NULL,
"orderUnitLoc: Invalid unit pointer" );
ASSERT( order == DORDER_NONE ||
order == DORDER_MOVE ||
@ -2539,7 +2539,7 @@ void orderDroidObj(DROID *psDroid, DROID_ORDER order, DROID_OACTION_INFO *psObj)
DROID_ORDER_DATA sOrder;
UBYTE i;
ASSERT( PTRVALID(psDroid, sizeof(DROID)),
ASSERT( psDroid != NULL,
"orderUnitObj: Invalid unit pointer" );
ASSERT( order == DORDER_NONE ||
order == DORDER_HELPBUILD ||
@ -2683,7 +2683,7 @@ void orderDroidStatsLoc(DROID *psDroid, DROID_ORDER order,
{
DROID_ORDER_DATA sOrder;
ASSERT( PTRVALID(psDroid, sizeof(DROID)),
ASSERT( psDroid != NULL,
"orderUnitStatsLoc: Invalid unit pointer" );
ASSERT( order == DORDER_BUILD,
"orderUnitStatsLoc: Invalid order for location" );
@ -2711,7 +2711,7 @@ void orderDroidStatsLocAdd(DROID *psDroid, DROID_ORDER order,
{
DROID_ORDER_DATA sOrder;
ASSERT( PTRVALID(psDroid, sizeof(DROID)),
ASSERT( psDroid != NULL,
"orderUnitStatsLoc: Invalid unit pointer" );
// can only queue build orders with this function
@ -2735,7 +2735,7 @@ void orderDroidStatsTwoLoc(DROID *psDroid, DROID_ORDER order,
{
DROID_ORDER_DATA sOrder;
ASSERT( PTRVALID(psDroid, sizeof(DROID)),
ASSERT( psDroid != NULL,
"orderUnitStatsTwoLoc: Invalid unit pointer" );
ASSERT( order == DORDER_LINEBUILD,
"orderUnitStatsTwoLoc: Invalid order for location" );
@ -2760,7 +2760,7 @@ void orderDroidStatsTwoLocAdd(DROID *psDroid, DROID_ORDER order,
{
DROID_ORDER_DATA sOrder;
ASSERT( PTRVALID(psDroid, sizeof(DROID)),
ASSERT( psDroid != NULL,
"orderUnitStatsTwoLocAdd: Invalid unit pointer" );
ASSERT( order == DORDER_LINEBUILD,
"orderUnitStatsTwoLocAdd: Invalid order for location" );
@ -2836,7 +2836,7 @@ void orderDroidAdd(DROID *psDroid, DROID_ORDER_DATA *psOrder)
Vector3i position;
ASSERT( PTRVALID(psDroid, sizeof(DROID)),
ASSERT( psDroid != NULL,
"orderUnitAdd: invalid unit pointer" );
if (psDroid->listSize >= ORDER_LIST_MAX)
@ -3216,7 +3216,7 @@ DROID_ORDER chooseOrderObj(DROID *psDroid, BASE_OBJECT *psObj)
psObj->type == OBJ_STRUCTURE)
{
psStruct = (STRUCTURE *) psObj;
ASSERT( PTRVALID(psObj, sizeof(STRUCTURE)),
ASSERT( psObj != NULL,
"chooseOrderObj: invalid structure pointer" );
if ( psStruct->pStructureType->type == REF_REPAIR_FACILITY &&
psStruct->status == SS_BUILT)
@ -3352,7 +3352,7 @@ DROID_ORDER chooseOrderObj(DROID *psDroid, BASE_OBJECT *psObj)
psObj->type == OBJ_STRUCTURE )
{
psStruct = (STRUCTURE *) psObj;
ASSERT( PTRVALID(psObj, sizeof(STRUCTURE)),
ASSERT( psObj != NULL,
"chooseOrderObj: invalid structure pointer" );
/* check whether construction droid */
@ -3471,7 +3471,7 @@ DROID_ORDER chooseOrderObj(DROID *psDroid, BASE_OBJECT *psObj)
psObj->type == OBJ_FEATURE )
{
psFeature = (FEATURE *) psObj;
ASSERT( PTRVALID(psObj, sizeof(FEATURE)),
ASSERT( psObj != NULL,
"chooseOrderObj: invalid feature pointer" );
if (psFeature->psStats->subType == FEAT_BUILD_WRECK)
{

View File

@ -901,7 +901,7 @@ BOOL structUsesPower(STRUCTURE *psStruct)
{
BOOL bUsesPower = FALSE;
ASSERT( PTRVALID(psStruct, sizeof(STRUCTURE)),
ASSERT( psStruct != NULL,
"structUsesPower: Invalid Structure pointer" );
switch(psStruct->pStructureType->type)
@ -926,7 +926,7 @@ BOOL droidUsesPower(DROID *psDroid)
{
BOOL bUsesPower = FALSE;
ASSERT( PTRVALID(psDroid, sizeof(DROID)),
ASSERT( psDroid != NULL,
"unitUsesPower: Invalid unit pointer" );
switch(psDroid->droidType)

View File

@ -321,7 +321,7 @@ proj_SendProjectile( WEAPON *psWeap, BASE_OBJECT *psAttacker, SDWORD player,
UDWORD heightVariance;
WEAPON_STATS *psWeapStats = &asWeaponStats[psWeap->nStat];
ASSERT( PTRVALID(psWeapStats,sizeof(WEAPON_STATS)),
ASSERT( psWeapStats != NULL,
"proj_SendProjectile: invalid weapon stats" );
/* get unused projectile object from hashtable*/
@ -618,11 +618,11 @@ proj_InFlightDirectFunc( PROJ_OBJECT *psObj )
BOOL bPenetrate;
WEAPON asWeap;
ASSERT( PTRVALID(psObj, sizeof(PROJ_OBJECT)),
ASSERT( psObj != NULL,
"proj_InFlightDirectFunc: invalid projectile pointer" );
psStats = psObj->psWStats;
ASSERT( PTRVALID(psStats, sizeof(WEAPON_STATS)),
ASSERT( psStats != NULL,
"proj_InFlightDirectFunc: Invalid weapon stats pointer" );
bPenetrate = psStats->penetrate;
@ -909,12 +909,12 @@ proj_InFlightIndirectFunc( PROJ_OBJECT *psObj )
BOOL bPenetrate;
WEAPON asWeap;
ASSERT( PTRVALID(psObj, sizeof(PROJ_OBJECT)),
ASSERT( psObj != NULL,
"proj_InFlightIndirectFunc: invalid projectile pointer" );
psStats = psObj->psWStats;
bPenetrate = psStats->penetrate;
ASSERT( PTRVALID(psStats, sizeof(WEAPON_STATS)),
ASSERT( psStats != NULL,
"proj_InFlightIndirectFunc: Invalid weapon stats pointer" );
iTime = gameTime - psObj->born;
@ -1159,11 +1159,11 @@ proj_ImpactFunc( PROJ_OBJECT *psObj )
int impact_angle;
ASSERT( PTRVALID(psObj, sizeof(PROJ_OBJECT)),
ASSERT( psObj != NULL,
"proj_ImpactFunc: invalid projectile pointer" );
psStats = psObj->psWStats;
ASSERT( PTRVALID(psStats, sizeof(WEAPON_STATS)),
ASSERT( psStats != NULL,
"proj_ImpactFunc: Invalid weapon stats pointer" );
/* play impact audio */
@ -1229,7 +1229,7 @@ proj_ImpactFunc( PROJ_OBJECT *psObj )
bKilled = FALSE;
if ( psObj->psDest != NULL )
{
ASSERT( PTRVALID(psObj->psDest, sizeof(BASE_OBJECT)),
ASSERT( psObj->psDest != NULL,
"proj_ImpactFunc: Invalid destination object pointer" );
}
@ -1827,11 +1827,11 @@ proj_PostImpactFunc( PROJ_OBJECT *psObj )
SDWORD i, age;
FIRE_BOX flame;
ASSERT( PTRVALID(psObj, sizeof(PROJ_OBJECT)),
ASSERT( psObj != NULL,
"proj_PostImpactFunc: invalid projectile pointer" );
psStats = psObj->psWStats;
ASSERT( PTRVALID(psStats, sizeof(WEAPON_STATS)),
ASSERT( psStats != NULL,
"proj_PostImpactFunc: Invalid weapon stats pointer" );
age = (SDWORD)gameTime - (SDWORD)psObj->born;
@ -1876,7 +1876,7 @@ proj_PostImpactFunc( PROJ_OBJECT *psObj )
static void
proj_Update( PROJ_OBJECT *psObj )
{
ASSERT( PTRVALID(psObj, sizeof(PROJ_OBJECT)),
ASSERT( psObj != NULL,
"proj_Update: Invalid bullet pointer" );
/* See if any of the stored objects have died

View File

@ -3029,8 +3029,7 @@ BOOL checkResearchStats(void)
{
for (inc=0; inc < asResearch[resInc].numArteResults; inc++)
{
ASSERT( PTRVALID(asResearch[resInc].pArtefactResults[inc],
sizeof(COMP_BASE_STATS*)),
ASSERT( asResearch[resInc].pArtefactResults[inc] != NULL,
"checkResearchStats: Invalid Comp Result for topic %s",
getResearchName(asResearch[resInc]) );
}
@ -3049,8 +3048,7 @@ BOOL checkResearchStats(void)
{
for (inc=0; inc < asResearch[resInc].numRedArtefacts; inc++)
{
ASSERT( PTRVALID(asResearch[resInc].pRedArtefacts[inc],
sizeof(COMP_BASE_STATS*)),
ASSERT( asResearch[resInc].pRedArtefacts[inc] != NULL,
"checkResearchStats: Invalid Redundant Comp for topic %s",
getResearchName(asResearch[resInc]) );
}
@ -3195,7 +3193,7 @@ static void switchComponent(DROID *psDroid, UDWORD oldType, UDWORD oldCompInc,
UDWORD newCompInc)
{
ASSERT( PTRVALID(psDroid, sizeof(DROID)),
ASSERT( psDroid != NULL,
"switchComponent:invalid droid pointer" );
switch(oldType)

View File

@ -60,9 +60,9 @@ BOOL scrGroupAddDroid(void)
return FALSE;
}
ASSERT( PTRVALID(psGroup, sizeof(DROID_GROUP)),
ASSERT( psGroup != NULL,
"scrGroupAdd: Invalid group pointer" );
ASSERT( PTRVALID(psDroid, sizeof(DROID)),
ASSERT( psDroid != NULL,
"scrGroupAdd: Invalid droid pointer" );
if (psDroid == NULL)
{
@ -100,7 +100,7 @@ BOOL scrGroupAddArea(void)
return FALSE;
}
ASSERT( PTRVALID(psGroup, sizeof(DROID_GROUP)),
ASSERT( psGroup != NULL,
"scrGroupAdd: Invalid group pointer" );
if (player < 0 || player >= MAX_PLAYERS)
@ -140,7 +140,7 @@ BOOL scrGroupAddAreaNoGroup(void)
return FALSE;
}
ASSERT( PTRVALID(psGroup, sizeof(DROID_GROUP)),
ASSERT( psGroup != NULL,
"scrGroupAddNoGroup: Invalid group pointer" );
if (player < 0 || player >= MAX_PLAYERS)
@ -176,9 +176,9 @@ BOOL scrGroupAddGroup(void)
return FALSE;
}
ASSERT( PTRVALID(psTo, sizeof(DROID_GROUP)),
ASSERT( psTo != NULL,
"scrGroupAddGroup: Invalid group pointer" );
ASSERT( PTRVALID(psFrom, sizeof(DROID_GROUP)),
ASSERT( psFrom != NULL,
"scrGroupAddGroup: Invalid group pointer" );
for(psDroid=psFrom->psList; psDroid; psDroid=psNext)
@ -203,9 +203,9 @@ BOOL scrGroupMember(void)
return FALSE;
}
ASSERT( PTRVALID(psGroup, sizeof(DROID_GROUP)),
ASSERT( psGroup != NULL,
"scrGroupMember: Invalid group pointer" );
ASSERT( PTRVALID(psDroid, sizeof(DROID)),
ASSERT( psDroid != NULL,
"scrGroupMember: Invalid droid pointer" );
if (psDroid == NULL)
{
@ -243,7 +243,7 @@ BOOL scrIdleGroup(void)
return FALSE;
}
ASSERT( PTRVALID(psGroup, sizeof(DROID_GROUP)),
ASSERT( psGroup != NULL,
"scrIdleGroup: invalid group pointer" );
for(psDroid = psGroup->psList;psDroid; psDroid = psDroid->psGrpNext)
@ -277,7 +277,7 @@ BOOL scrInitIterateGroup(void)
return FALSE;
}
ASSERT( PTRVALID(psGroup, sizeof(DROID_GROUP)),
ASSERT( psGroup != NULL,
"scrInitGroupIterate: invalid group pointer" );
psScrIterateGroup = psGroup;
@ -388,7 +388,7 @@ BOOL scrOrderGroup(void)
return FALSE;
}
ASSERT( PTRVALID(psGroup, sizeof(DROID_GROUP)),
ASSERT( psGroup != NULL,
"scrOrderGroup: Invalid group pointer" );
if (order != DORDER_STOP &&
@ -422,7 +422,7 @@ BOOL scrOrderGroupLoc(void)
return FALSE;
}
ASSERT( PTRVALID(psGroup, sizeof(DROID_GROUP)),
ASSERT( psGroup != NULL,
"scrOrderGroupLoc: Invalid group pointer" );
if (order != DORDER_MOVE &&
@ -460,9 +460,9 @@ BOOL scrOrderGroupObj(void)
return FALSE;
}
ASSERT( PTRVALID(psGroup, sizeof(DROID_GROUP)),
ASSERT( psGroup != NULL,
"scrOrderGroupObj: Invalid group pointer" );
ASSERT( PTRVALID(psObj, sizeof(BASE_OBJECT)),
ASSERT( psObj != NULL,
"scrOrderGroupObj: Invalid object pointer" );
if (order != DORDER_ATTACK &&
@ -497,7 +497,7 @@ BOOL scrOrderDroid(void)
return FALSE;
}
ASSERT( PTRVALID(psDroid, sizeof(DROID)),
ASSERT( psDroid != NULL,
"scrOrderUnit: Invalid unit pointer" );
if (psDroid == NULL)
{
@ -534,7 +534,7 @@ BOOL scrOrderDroidLoc(void)
return FALSE;
}
ASSERT( PTRVALID(psDroid, sizeof(DROID)),
ASSERT( psDroid != NULL,
"scrOrderUnitLoc: Invalid unit pointer" );
if (psDroid == NULL)
{
@ -575,9 +575,9 @@ BOOL scrOrderDroidObj(void)
return FALSE;
}
ASSERT( PTRVALID(psDroid, sizeof(DROID)),
ASSERT( psDroid != NULL,
"scrOrderUnitObj: Invalid unit pointer" );
ASSERT( PTRVALID(psObj, sizeof(BASE_OBJECT)),
ASSERT( psObj != NULL,
"scrOrderUnitObj: Invalid object pointer" );
if (psDroid == NULL || psObj == NULL)
{
@ -627,9 +627,9 @@ BOOL scrOrderDroidStatsLoc(void)
}
psStats = (BASE_STATS *)(asStructureStats + statIndex);
ASSERT( PTRVALID(psDroid, sizeof(DROID)),
ASSERT( psDroid != NULL,
"scrOrderUnitStatsLoc: Invalid Unit pointer" );
ASSERT( PTRVALID(psStats, sizeof(BASE_STATS)),
ASSERT( psStats != NULL,
"scrOrderUnitStatsLoc: Invalid object pointer" );
if (psDroid == NULL)
{
@ -673,7 +673,7 @@ BOOL scrSetDroidSecondary(void)
return FALSE;
}
ASSERT( PTRVALID(psDroid, sizeof(DROID)),
ASSERT( psDroid != NULL,
"scrSetUnitSecondary: invalid unit pointer" );
if (psDroid == NULL)
{
@ -697,7 +697,7 @@ BOOL scrSetGroupSecondary(void)
return FALSE;
}
ASSERT( PTRVALID(psGroup, sizeof(DROID_GROUP)),
ASSERT( psGroup != NULL,
"scrSetGroupSecondary: invalid group pointer" );
grpSetSecondary(psGroup, sec, state);
@ -2104,9 +2104,9 @@ BOOL scrActionDroidObj(void)
return FALSE;
}
ASSERT( PTRVALID(psDroid, sizeof(DROID)),
ASSERT( psDroid != NULL,
"scrOrderUnitObj: Invalid unit pointer" );
ASSERT( PTRVALID(psObj, sizeof(BASE_OBJECT)),
ASSERT( psObj != NULL,
"scrOrderUnitObj: Invalid object pointer" );
if (psDroid == NULL || psObj == NULL)
@ -2143,7 +2143,7 @@ BOOL scrInitIterateGroupB(void)
return FALSE;
}
ASSERT( PTRVALID(psGroup, sizeof(DROID_GROUP)),
ASSERT( psGroup != NULL,
"scrInitIterateGroupB: invalid group pointer" );
ASSERT( bucket < MAX_PLAYERS,
@ -2214,9 +2214,9 @@ BOOL scrIterateGroupB(void)
psStats = (BASE_STATS *)(asStructureStats + statIndex);
ASSERT( PTRVALID(psDroid, sizeof(DROID)),
ASSERT( psDroid != NULL,
"scrOrderDroidLineBuild: Invalid Unit pointer" );
ASSERT( PTRVALID(psStats, sizeof(BASE_STATS)),
ASSERT( psStats != NULL,
"scrOrderDroidLineBuild: Invalid object pointer" );
if (psDroid == NULL)
{

View File

@ -311,7 +311,7 @@ BOOL scrCBDroidSelected(void)
return FALSE;
}
ASSERT( PTRVALID(psCBSelectedDroid, sizeof(DROID)),
ASSERT( psCBSelectedDroid != NULL,
"scrSCUnitSelected: invalid unit pointer" );
*ppsDroid = psCBSelectedDroid;

View File

@ -874,7 +874,7 @@ BOOL scrAddDroidToMissionList(void)
return FALSE;
}
ASSERT( PTRVALID(psTemplate, sizeof(DROID_TEMPLATE)),
ASSERT( psTemplate != NULL,
"scrAddUnitToMissionList: Invalid template pointer" );
#ifdef SCRIPT_CHECK_MAX_UNITS
@ -927,7 +927,7 @@ BOOL scrAddDroid(void)
return FALSE;
}
ASSERT( PTRVALID(psTemplate, sizeof(DROID_TEMPLATE)),
ASSERT( psTemplate != NULL,
"scrAddUnit: Invalid template pointer" );
#ifdef SCRIPT_CHECK_MAX_UNITS
@ -978,9 +978,9 @@ BOOL scrAddDroidToTransporter(void)
return TRUE;
}
ASSERT( PTRVALID(psTransporter, sizeof(DROID)),
ASSERT( psTransporter != NULL,
"scrAddUnitToTransporter: invalid transporter pointer" );
ASSERT( PTRVALID(psDroid, sizeof(DROID)),
ASSERT( psDroid != NULL,
"scrAddUnitToTransporter: invalid unit pointer" );
ASSERT( psTransporter->droidType == DROID_TRANSPORTER,
"scrAddUnitToTransporter: invalid transporter type" );
@ -1488,13 +1488,13 @@ BOOL scrBuildDroid(void)
return FALSE;
}
ASSERT( PTRVALID(psFactory, sizeof(STRUCTURE)),
ASSERT( psFactory != NULL,
"scrBuildUnit: Invalid structure pointer" );
ASSERT( (psFactory->pStructureType->type == REF_FACTORY ||
psFactory->pStructureType->type == REF_CYBORG_FACTORY ||
psFactory->pStructureType->type == REF_VTOL_FACTORY),
"scrBuildUnit: structure is not a factory" );
ASSERT( PTRVALID(psTemplate, sizeof(DROID_TEMPLATE)),
ASSERT( psTemplate != NULL,
"scrBuildUnit: Invalid template pointer" );
//check building the right sort of droid for the factory
@ -1619,7 +1619,7 @@ BOOL scrDestroyFeature(void)
if (psFeature == NULL)
{
ASSERT( PTRVALID(psFeature, sizeof(FEATURE)),
ASSERT( psFeature != NULL,
"scrDestroyFeature: Invalid feature pointer" );
}
@ -1867,7 +1867,7 @@ BOOL scrAddFeature(void)
psStat = (FEATURE_STATS *)(asFeatureStats + iFeat);
ASSERT( PTRVALID(psStat, sizeof(FEATURE_STATS)),
ASSERT( psStat != NULL,
"scrAddFeature: Invalid feature pointer" );
if ( psStat != NULL )
@ -1926,7 +1926,7 @@ BOOL scrAddStructure(void)
psStat = (STRUCTURE_STATS *)(asStructureStats + iStruct);
ASSERT( PTRVALID(psStat, sizeof(STRUCTURE_STATS)),
ASSERT( psStat != NULL,
"scrAddStructure: Invalid feature pointer" );
if ( psStat != NULL )
@ -1993,7 +1993,7 @@ BOOL scrDestroyStructure(void)
if (psStruct == NULL)
{
ASSERT( PTRVALID(psStruct, sizeof(STRUCTURE)),
ASSERT( psStruct != NULL,
"scrDestroyStructure: Invalid structure pointer" );
}
@ -5570,7 +5570,7 @@ BOOL scrAddTemplate(void)
return FALSE;
}
ASSERT( PTRVALID(psTemplate, sizeof(DROID_TEMPLATE)),"scrAddTemplate: Invalid template pointer" );
ASSERT( psTemplate != NULL, "scrAddTemplate: Invalid template pointer" );
if( addTemplate(player,psTemplate))
{
@ -6039,7 +6039,7 @@ BOOL scrTakeOverSingleDroid(void)
return FALSE;
}
ASSERT( PTRVALID(psDroidToTake, sizeof(DROID)),
ASSERT( psDroidToTake != NULL,
"scrTakeOverSingleUnit: Invalid unit pointer" );
psNewDroid = giftSingleDroid(psDroidToTake, playerToGain);
@ -6155,7 +6155,7 @@ BOOL scrTakeOverSingleStructure(void)
return FALSE;
}
ASSERT( PTRVALID(psStructToTake, sizeof(STRUCTURE)),
ASSERT( psStructToTake != NULL,
"scrTakeOverSingleStructure: Invalid structure pointer" );
structureInc = psStructToTake->pStructureType->ref - REF_STRUCTURE_START;
@ -6801,7 +6801,7 @@ BOOL scrFactoryGetTemplate(void)
return FALSE;
}
ASSERT( PTRVALID(psStructure, sizeof(STRUCTURE)),
ASSERT( psStructure != NULL,
"scrFactoryGetTemplate: Invalid structure pointer" );
ASSERT( (psStructure->pStructureType->type == REF_FACTORY ||
psStructure->pStructureType->type == REF_CYBORG_FACTORY ||
@ -6816,7 +6816,7 @@ BOOL scrFactoryGetTemplate(void)
psTemplate = (DROID_TEMPLATE *)((FACTORY*)psStructure->pFunctionality)->psSubject;
ASSERT( PTRVALID(psTemplate, sizeof(DROID_TEMPLATE)),
ASSERT( psTemplate != NULL,
"scrFactoryGetTemplate: Invalid template pointer" );
scrFunctionResult.v.oval = psTemplate;
@ -6850,7 +6850,7 @@ BOOL scrNumTemplatesInProduction(void)
return FALSE;
}
ASSERT( PTRVALID(psTemplate, sizeof(DROID_TEMPLATE)),
ASSERT( psTemplate != NULL,
"scrNumTemplatesInProduction: Invalid template pointer" );
psBaseStats = (BASE_STATS *)psTemplate; //Convert
@ -8215,7 +8215,7 @@ BOOL scrNumStructsByStatInArea(void)
psStats = (STRUCTURE_STATS *)(asStructureStats + index);
ASSERT( PTRVALID(psStats, sizeof(STRUCTURE_STATS)),
ASSERT( psStats != NULL,
"scrNumStructsByStatInArea: Invalid structure pointer" );
NumStruct = 0;

View File

@ -173,7 +173,7 @@ UDWORD count;
{
/* Get the propulsion type */
psPropStats = asPropulsionStats + psDroid->asBits[COMP_PROPULSION].nStat;
ASSERT( PTRVALID(psPropStats, sizeof(PROPULSION_STATS)),
ASSERT( psPropStats != NULL,
"moveUpdateUnit: invalid propulsion stats pointer" );
/* Same as that asked for - don't want Transporters*/
if ( psPropStats->propulsionType == propType && psDroid->droidType != DROID_TRANSPORTER)

View File

@ -1490,7 +1490,7 @@ BOOL structureDamage(STRUCTURE *psStructure, UDWORD damage, UDWORD weaponClass,
{
UDWORD penDamage, armourDamage;
ASSERT( PTRVALID(psStructure, sizeof(STRUCTURE)),
ASSERT( psStructure != NULL,
"structureDamage: Invalid Structure pointer" );
debug( LOG_ATTACK, "structureDamage(%d): body %d armour %d damage: %d\n",
@ -1591,14 +1591,12 @@ BOOL structSetManufacture(STRUCTURE *psStruct, DROID_TEMPLATE *psTempl, UBYTE qu
{
FACTORY *psFact;
ASSERT( PTRVALID(psStruct, sizeof(STRUCTURE)) && psStruct->type == OBJ_STRUCTURE &&
ASSERT( psStruct != NULL && psStruct->type == OBJ_STRUCTURE &&
(psStruct->pStructureType->type == REF_FACTORY ||
psStruct->pStructureType->type == REF_CYBORG_FACTORY ||
psStruct->pStructureType->type == REF_VTOL_FACTORY),
"structSetManufacture: invalid Factory pointer" );
/* psTempl might be NULL if the build is being cancelled in the middle */
ASSERT( psTempl == NULL || PTRVALID(psTempl, sizeof(DROID_TEMPLATE)),
"structSetManufacture: invalid Template pointer" );
//assign it to the Factory
psFact = (FACTORY*)psStruct->pFunctionality;
@ -2020,7 +2018,7 @@ STRUCTURE* buildStructure(STRUCTURE_STATS* pStructureType, UDWORD x, UDWORD y,
return NULL;
}
//DBPRINTF(("create structure called\n");
//if (PTRVALID(psBuilding,sizeof(STRUCTURE)) != TRUE) DBPRINTF(("...and its not valid\n");
//if (psBuilding == NULL) DBPRINTF(("...and its not valid\n");
psBuilding->psCurAnim = NULL;
@ -3851,7 +3849,7 @@ static void aiUpdateStructure(STRUCTURE *psStructure)
#endif
UDWORD i;
ASSERT( PTRVALID(psStructure, sizeof(STRUCTURE)),
ASSERT( psStructure != NULL,
"aiUpdateStructure: invalid Structure pointer" );
if (psStructure->numWeaps > 0)
@ -4089,7 +4087,7 @@ static void aiUpdateStructure(STRUCTURE *psStructure)
/* select next droid if none being repaired */
if ( psChosenObj == NULL )
{
ASSERT( PTRVALID( psRepairFac->psGroup, sizeof(DROID_GROUP) ),
ASSERT( psRepairFac->psGroup != NULL,
"aiUpdateStructure: invalid repair facility group pointer" );
// get droid next in repair queue
@ -4523,7 +4521,7 @@ static void aiUpdateStructure(STRUCTURE *psStructure)
UDWORD powerCost;//, iPower;
psDroid = (DROID *) psChosenObj;
ASSERT( PTRVALID(psDroid, sizeof(DROID)),
ASSERT( psDroid != NULL,
"aiUpdateStructure: invalid droid pointer" );
psRepairFac = (REPAIR_FACILITY*)psStructure->pFunctionality;
@ -4729,7 +4727,7 @@ static void aiUpdateStructure(STRUCTURE *psStructure)
psReArmPad = (REARM_PAD *)psStructure->pFunctionality;
psDroid = (DROID *)psChosenObj;
ASSERT( PTRVALID(psDroid, sizeof(DROID)),
ASSERT( psDroid != NULL,
"aiUpdateStructure: invalid droid pointer" );
ASSERT( vtolDroid(psDroid),"aiUpdateStructure: invalid droid type" );
@ -4953,7 +4951,7 @@ void structureUpdate(STRUCTURE *psBuilding)
UDWORD percentDamage, emissionInterval, iPointsToAdd, iPointsRequired;
Vector3i dv;
ASSERT( PTRVALID(psBuilding, sizeof(STRUCTURE)),
ASSERT( psBuilding != NULL,
"structureUpdate: Invalid Structure pointer" );
//update the manufacture/research of the building once complete
@ -6259,7 +6257,7 @@ BOOL removeStruct(STRUCTURE *psDel, BOOL bDestroy)
//UDWORD mapX, mapY;
FLAG_POSITION *psAssemblyPoint=NULL;
ASSERT( PTRVALID(psDel, sizeof(STRUCTURE)),
ASSERT( psDel != NULL,
"destroyStruct: invalid structure pointer\n" );
@ -6423,7 +6421,7 @@ BOOL destroyStruct(STRUCTURE *psDel)
BOOL bMinor;
bMinor = FALSE;
ASSERT( PTRVALID(psDel, sizeof(STRUCTURE)),
ASSERT( psDel != NULL,
"destroyStruct: invalid structure pointer\n" );
@ -6924,7 +6922,7 @@ bCheck is set to TRUE for initial placement of the Assembly Point*/
void setAssemblyPoint(FLAG_POSITION *psAssemblyPoint, UDWORD x, UDWORD y,
UDWORD player, BOOL bCheck)
{
ASSERT( PTRVALID(psAssemblyPoint, sizeof(FLAG_POSITION)),
ASSERT( psAssemblyPoint != NULL,
"setAssemblyPoint: invalid AssemblyPoint pointer" );
//check its valid
@ -7684,7 +7682,7 @@ STRUCTURE_STATS* getModuleStat(STRUCTURE *psStruct)
STRUCTURE_STATS *psStat;
//UDWORD i;
ASSERT( PTRVALID(psStruct, sizeof(STRUCTURE)),
ASSERT( psStruct != NULL,
"getModuleStat: Invalid structure pointer" );
psStat = NULL;
@ -7730,7 +7728,7 @@ void printStructureInfo(STRUCTURE *psStructure)
UBYTE numConnected, i;
POWER_GEN *psPowerGen;
ASSERT( PTRVALID(psStructure, sizeof(STRUCTURE)),
ASSERT( psStructure != NULL,
"printStructureInfo: Invalid Structure pointer" );
switch (psStructure->pStructureType->type)
@ -7872,7 +7870,7 @@ BOOL electronicDamage(BASE_OBJECT *psTarget, UDWORD damage, UBYTE attackPlayer)
psStructure = (STRUCTURE *)psTarget;
bCompleted = FALSE;
ASSERT( PTRVALID(psStructure, sizeof(STRUCTURE)),
ASSERT( psStructure != NULL,
"electronicDamage: Invalid Structure pointer" );
ASSERT( psStructure->pStructureType->resistance != 0,
@ -7924,7 +7922,7 @@ BOOL electronicDamage(BASE_OBJECT *psTarget, UDWORD damage, UBYTE attackPlayer)
psDroid = (DROID *)psTarget;
bCompleted = FALSE;
ASSERT( PTRVALID(psDroid, sizeof(DROID)),
ASSERT( psDroid != NULL,
"electronicDamage: Invalid Droid pointer" );
//in multiPlayer cannot attack a Transporter with EW
@ -8021,7 +8019,7 @@ BOOL validStructResistance(STRUCTURE *psStruct)
{
BOOL bTarget = FALSE;
ASSERT( PTRVALID(psStruct, sizeof(STRUCTURE)),
ASSERT( psStruct != NULL,
"invalidStructResistance: invalid structure pointer" );
#ifdef TEST_EW
@ -8101,7 +8099,7 @@ UDWORD structureBaseBody(STRUCTURE *psStructure)
UBYTE player, capacity;
UDWORD body;
ASSERT( PTRVALID(psStructure, sizeof(STRUCTURE)),
ASSERT( psStructure != NULL,
"structureBaseBody: invalid structure pointer" );
psStats = psStructure->pStructureType;
@ -8112,7 +8110,7 @@ UDWORD structureBaseBody(STRUCTURE *psStructure)
//modules may be attached
case REF_FACTORY:
case REF_VTOL_FACTORY:
ASSERT( PTRVALID(psStructure->pFunctionality, sizeof(FUNCTIONALITY)),
ASSERT( psStructure->pFunctionality != NULL,
"structureBaseBody: invalid structure functionality pointer" );
if (((FACTORY *)psStructure->pFunctionality)->capacity > 0)
{
@ -8134,7 +8132,7 @@ UDWORD structureBaseBody(STRUCTURE *psStructure)
}
break;
case REF_RESEARCH:
ASSERT( PTRVALID(psStructure->pFunctionality, sizeof(FUNCTIONALITY)),
ASSERT( psStructure->pFunctionality != NULL,
"structureBaseBody: invalid structure functionality pointer" );
if (((RESEARCH_FACILITY *)psStructure->pFunctionality)->capacity > 0)
{
@ -8151,7 +8149,7 @@ UDWORD structureBaseBody(STRUCTURE *psStructure)
}
break;
case REF_POWER_GEN:
ASSERT( PTRVALID(psStructure->pFunctionality, sizeof(FUNCTIONALITY)),
ASSERT( psStructure->pFunctionality != NULL,
"structureBaseBody: invalid structure functionality pointer" );
if (((POWER_GEN *)psStructure->pFunctionality)->capacity > 0)
{
@ -9633,8 +9631,8 @@ BOOL checkStructureStats(void)
for (inc = 0; inc < asStructureStats[structInc].numFuncs; inc++)
{
ASSERT( PTRVALID(asStructureStats[structInc].asFuncList[inc],
sizeof(FUNCTION *)),"checkStructureStats: \
ASSERT( asStructureStats[structInc].asFuncList[inc] != NULL,
"checkStructureStats: \
Invalid function for structure %s",
asStructureStats[structInc].pName );

View File

@ -1646,9 +1646,9 @@ BOOL checkTransporterSpace(DROID *psTransporter, DROID *psAssigned)
DROID *psDroid, *psNext;
UDWORD capacity;
ASSERT( PTRVALID(psTransporter, sizeof(DROID)),
ASSERT( psTransporter != NULL,
"checkTransporterSpace: Invalid droid pointer" );
ASSERT( PTRVALID(psAssigned, sizeof(DROID)),
ASSERT( psAssigned != NULL,
"checkTransporterSpace: Invalid droid pointer" );
ASSERT( psTransporter->droidType == DROID_TRANSPORTER,
"checkTransporterSpace: Droid is not a Transporter" );
@ -1807,7 +1807,7 @@ BOOL launchTransporter(DROID *psTransporter)
have arrived - returns TRUE when there*/
BOOL updateTransporter(DROID *psTransporter)
{
ASSERT( PTRVALID(psTransporter, sizeof(DROID)),
ASSERT( psTransporter != NULL,
"updateTransporter: Invalid droid pointer" );
@ -2042,7 +2042,7 @@ void resetTransporter(DROID *psTransporter)
/*checks the order of the droid to see if its currently flying*/
BOOL transporterFlying(DROID *psTransporter)
{
ASSERT( PTRVALID(psTransporter, sizeof(DROID)),
ASSERT( psTransporter != NULL,
"transporterFlying: Invalid droid pointer" );
ASSERT( psTransporter->droidType == DROID_TRANSPORTER,
"transporterFlying: Droid is not a Transporter" );