diff --git a/src/droid.c b/src/droid.c index 34442e5ab..c7d13927f 100644 --- a/src/droid.c +++ b/src/droid.c @@ -3745,7 +3745,7 @@ UDWORD getNumDroidsForLevel(UDWORD level) // Get the name of a droid from it's DROID structure. // -char *droidGetName(DROID *psDroid) +const char *droidGetName(const DROID *psDroid) { return psDroid->aName; } diff --git a/src/droid.h b/src/droid.h index ad6fb4465..00f6700f8 100644 --- a/src/droid.h +++ b/src/droid.h @@ -256,7 +256,7 @@ extern UDWORD getDroidEffectiveLevel(DROID *psDroid); extern const char *getDroidLevelName(DROID *psDroid); // Get a droid's name. -extern char *droidGetName(DROID *psDroid); +extern const char *droidGetName(const DROID *psDroid); // Set a droid's name. extern void droidSetName(DROID *psDroid, const char *pName); diff --git a/src/mapgrid.c b/src/mapgrid.c index 3ac7a6063..b1359887a 100644 --- a/src/mapgrid.c +++ b/src/mapgrid.c @@ -232,7 +232,7 @@ void gridRemoveObject(BASE_OBJECT *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; } } @@ -499,7 +499,7 @@ void gridDisplayCoverage(BASE_OBJECT *psObj) unsigned int x, y, i; 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(y = 0; y < gridHeight; y++) @@ -510,7 +510,7 @@ void gridDisplayCoverage(BASE_OBJECT *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; diff --git a/src/move.h b/src/move.h index 972c374a4..544bcec59 100644 --- a/src/move.h +++ b/src/move.h @@ -80,9 +80,6 @@ SDWORD moveCalcDroidSpeed(DROID *psDroid); /* Frame update for the movement of a tracked droid */ extern void moveUpdateTracked(DROID *psDroid); -extern void fillNewBlocks(DROID *psDroid); -extern void fillInitialView(DROID *psDroid); - /* update body and turret to local slope */ extern void updateDroidOrientation(DROID *psDroid); diff --git a/src/objects.c b/src/objects.c index 6317b2e9b..739ab69d3 100644 --- a/src/objects.c +++ b/src/objects.c @@ -71,3 +71,43 @@ void reverseObjectList(BASE_OBJECT **ppsList) //set the list passed in to point to the new top *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; +} diff --git a/src/objects.h b/src/objects.h index db3292550..e43d7c334 100644 --- a/src/objects.h +++ b/src/objects.h @@ -45,4 +45,7 @@ extern BOOL objShutdown(void); the last and the last entry becomes the first!*/ 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__