Improve assert message when getting the gridRemove crash.
git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@6983 4a71c877-e1ca-e34f-864e-861f7616d084master
parent
c0358510d8
commit
5ee8538680
|
@ -3745,7 +3745,7 @@ UDWORD getNumDroidsForLevel(UDWORD level)
|
||||||
|
|
||||||
// Get the name of a droid from it's DROID structure.
|
// Get the name of a droid from it's DROID structure.
|
||||||
//
|
//
|
||||||
char *droidGetName(DROID *psDroid)
|
const char *droidGetName(const DROID *psDroid)
|
||||||
{
|
{
|
||||||
return psDroid->aName;
|
return psDroid->aName;
|
||||||
}
|
}
|
||||||
|
|
|
@ -256,7 +256,7 @@ extern UDWORD getDroidEffectiveLevel(DROID *psDroid);
|
||||||
extern const char *getDroidLevelName(DROID *psDroid);
|
extern const char *getDroidLevelName(DROID *psDroid);
|
||||||
|
|
||||||
// Get a droid's name.
|
// Get a droid's name.
|
||||||
extern char *droidGetName(DROID *psDroid);
|
extern const char *droidGetName(const DROID *psDroid);
|
||||||
|
|
||||||
// Set a droid's name.
|
// Set a droid's name.
|
||||||
extern void droidSetName(DROID *psDroid, const char *pName);
|
extern void droidSetName(DROID *psDroid, const char *pName);
|
||||||
|
|
|
@ -232,7 +232,7 @@ void gridRemoveObject(BASE_OBJECT *psObj)
|
||||||
{
|
{
|
||||||
if (psCurr->apsObjects[i] == psObj)
|
if (psCurr->apsObjects[i] == psObj)
|
||||||
{
|
{
|
||||||
ASSERT( false,"gridRemoveObject: grid out of sync" );
|
ASSERT(false, "Grid out of sync at (%u,%u):%u removing %s", x, y, i, objInfo(psObj));
|
||||||
psCurr->apsObjects[i] = NULL;
|
psCurr->apsObjects[i] = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -499,7 +499,7 @@ void gridDisplayCoverage(BASE_OBJECT *psObj)
|
||||||
unsigned int x, y, i;
|
unsigned int x, y, i;
|
||||||
GRID_ARRAY *psCurr;
|
GRID_ARRAY *psCurr;
|
||||||
|
|
||||||
debug( LOG_NEVER, "Grid coverage for object %d (%d,%d) - range %d\n", psObj->id, psObj->pos.x, psObj->pos.y, gridObjRange(psObj) );
|
debug(LOG_ERROR, "Grid coverage for object %d (%d,%d) - range %d", psObj->id, psObj->pos.x, psObj->pos.y, gridObjRange(psObj) );
|
||||||
for (x = 0; x < gridWidth; x++)
|
for (x = 0; x < gridWidth; x++)
|
||||||
{
|
{
|
||||||
for(y = 0; y < gridHeight; y++)
|
for(y = 0; y < gridHeight; y++)
|
||||||
|
@ -510,7 +510,7 @@ void gridDisplayCoverage(BASE_OBJECT *psObj)
|
||||||
{
|
{
|
||||||
if (psCurr->apsObjects[i] == psObj)
|
if (psCurr->apsObjects[i] == psObj)
|
||||||
{
|
{
|
||||||
debug( LOG_NEVER, " %d,%d [ %d,%d -> %d,%d ]\n", x, y, x*GRID_UNITS, y*GRID_UNITS, (x+1)*GRID_UNITS, (y+1)*GRID_UNITS );
|
debug(LOG_ERROR, " %d,%d [ %d,%d -> %d,%d ]", x, y, x*GRID_UNITS, y*GRID_UNITS, (x+1)*GRID_UNITS, (y+1)*GRID_UNITS );
|
||||||
}
|
}
|
||||||
|
|
||||||
++i;
|
++i;
|
||||||
|
|
|
@ -80,9 +80,6 @@ SDWORD moveCalcDroidSpeed(DROID *psDroid);
|
||||||
/* Frame update for the movement of a tracked droid */
|
/* Frame update for the movement of a tracked droid */
|
||||||
extern void moveUpdateTracked(DROID *psDroid);
|
extern void moveUpdateTracked(DROID *psDroid);
|
||||||
|
|
||||||
extern void fillNewBlocks(DROID *psDroid);
|
|
||||||
extern void fillInitialView(DROID *psDroid);
|
|
||||||
|
|
||||||
/* update body and turret to local slope */
|
/* update body and turret to local slope */
|
||||||
extern void updateDroidOrientation(DROID *psDroid);
|
extern void updateDroidOrientation(DROID *psDroid);
|
||||||
|
|
||||||
|
|
|
@ -71,3 +71,43 @@ void reverseObjectList(BASE_OBJECT **ppsList)
|
||||||
//set the list passed in to point to the new top
|
//set the list passed in to point to the new top
|
||||||
*ppsList = psPrev;
|
*ppsList = psPrev;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char *objInfo(const BASE_OBJECT *psObj)
|
||||||
|
{
|
||||||
|
static char info[PATH_MAX];
|
||||||
|
|
||||||
|
switch (psObj->type)
|
||||||
|
{
|
||||||
|
case OBJ_DROID:
|
||||||
|
{
|
||||||
|
const DROID *psDroid = (const DROID *)psObj;
|
||||||
|
|
||||||
|
ssprintf(info, "%s", droidGetName(psDroid));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case OBJ_STRUCTURE:
|
||||||
|
{
|
||||||
|
const STRUCTURE *psStruct = (const STRUCTURE *)psObj;
|
||||||
|
|
||||||
|
ssprintf(info, "%s", getName(psStruct->pStructureType->pName));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case OBJ_FEATURE:
|
||||||
|
{
|
||||||
|
const FEATURE *psFeat = (const FEATURE *)psObj;
|
||||||
|
|
||||||
|
ssprintf(info, "%s", getName(psFeat->psStats->pName));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case OBJ_PROJECTILE:
|
||||||
|
sstrcpy(info, "Projectile"); // TODO
|
||||||
|
break;
|
||||||
|
case OBJ_TARGET:
|
||||||
|
sstrcpy(info, "Target"); // TODO
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
sstrcpy(info, "Unknown object type");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return info;
|
||||||
|
}
|
||||||
|
|
|
@ -45,4 +45,7 @@ extern BOOL objShutdown(void);
|
||||||
the last and the last entry becomes the first!*/
|
the last and the last entry becomes the first!*/
|
||||||
extern void reverseObjectList(BASE_OBJECT **ppsList);
|
extern void reverseObjectList(BASE_OBJECT **ppsList);
|
||||||
|
|
||||||
|
/** Output an informative string about this object. For debugging. */
|
||||||
|
const char *objInfo(const BASE_OBJECT *psObj);
|
||||||
|
|
||||||
#endif // __INCLUDED_SRC_OBJECTS_H__
|
#endif // __INCLUDED_SRC_OBJECTS_H__
|
||||||
|
|
Loading…
Reference in New Issue