diff --git a/src/mapgrid.c b/src/mapgrid.c index 253c782a8..d445edd21 100644 --- a/src/mapgrid.c +++ b/src/mapgrid.c @@ -193,29 +193,29 @@ static void gridCalcCoverage(BASE_OBJECT *psObj, SDWORD objx, SDWORD objy, COVER void gridAddObject(BASE_OBJECT *psObj) { ASSERT(!isDead(psObj), "Added a dead object to the map grid!"); - gridCalcCoverage(psObj, (SDWORD)psObj->pos.x, (SDWORD)psObj->pos.y, GRID_ADDOBJECT); + gridCalcCoverage(psObj, (SDWORD)psObj->pos.x, (SDWORD)psObj->pos.y, GRID_ADDOBJECT); } // move an object within the grid // oldX,oldY are the old position of the object in world coords -void gridMoveObject(BASE_OBJECT *psObj, SDWORD oldX, SDWORD oldY) +void gridMoveDroid(DROID* psDroid, SDWORD oldX, SDWORD oldY) { - if (map_coord(psObj->pos.x) == map_coord(oldX) - && map_coord(psObj->pos.y) == map_coord(oldY)) + if (map_coord(psDroid->pos.x) == map_coord(oldX) + && map_coord(psDroid->pos.y) == map_coord(oldY)) { // havn't changed the tile the object is on, don't bother updating return; } - gridCalcCoverage(psObj, oldX,oldY, GRID_REMOVEOBJECT); - gridCalcCoverage(psObj, (SDWORD)psObj->pos.x, (SDWORD)psObj->pos.y, GRID_ADDOBJECT); + gridCalcCoverage((BASE_OBJECT*)psDroid, oldX,oldY, GRID_REMOVEOBJECT); + gridCalcCoverage((BASE_OBJECT*)psDroid, psDroid->pos.x, psDroid->pos.y, GRID_ADDOBJECT); } // remove an object from the grid system void gridRemoveObject(BASE_OBJECT *psObj) { - gridCalcCoverage(psObj, (SDWORD)psObj->pos.x, (SDWORD)psObj->pos.y, GRID_REMOVEOBJECT); + gridCalcCoverage(psObj, (SDWORD)psObj->pos.x, (SDWORD)psObj->pos.y, GRID_REMOVEOBJECT); #if defined(DEBUG) { diff --git a/src/mapgrid.h b/src/mapgrid.h index cd0378f78..4328cbf24 100644 --- a/src/mapgrid.h +++ b/src/mapgrid.h @@ -57,9 +57,9 @@ extern void gridReset(void); // add an object to the grid system extern void gridAddObject(BASE_OBJECT *psObj); -// move an object within the grid +// move a DROID within the grid // oldX,oldY are the old position of the object in world coords -extern void gridMoveObject(BASE_OBJECT *psObj, SDWORD oldX, SDWORD oldY); +extern void gridMoveDroid(DROID* psDroid, SDWORD oldX, SDWORD oldY); // remove an object from the grid system extern void gridRemoveObject(BASE_OBJECT *psObj); diff --git a/src/move.c b/src/move.c index 4d19ced53..5b793996e 100644 --- a/src/move.c +++ b/src/move.c @@ -3384,7 +3384,7 @@ void moveUpdateDroid(DROID *psDroid) || map_coord(oldy) != map_coord(psDroid->pos.y)) { visTilesUpdate((BASE_OBJECT *)psDroid); - gridMoveObject((BASE_OBJECT *)psDroid, (SDWORD)oldx,(SDWORD)oldy); + gridMoveDroid(psDroid, (SDWORD)oldx,(SDWORD)oldy); // object moved from one tile to next, check to see if droid is near stuff.(oil) checkLocalFeatures(psDroid); diff --git a/src/multisync.c b/src/multisync.c index 9fae1b4a4..518634651 100644 --- a/src/multisync.c +++ b/src/multisync.c @@ -575,7 +575,7 @@ static void offscreenUpdate(DROID *psDroid, psDroid->pos.x = (UWORD) fx; //update move progress psDroid->pos.y = (UWORD) fy; - gridMoveObject((BASE_OBJECT *)psDroid, (SDWORD)oldx,(SDWORD)oldy); + gridMoveDroid(psDroid, (SDWORD)oldx,(SDWORD)oldy); psDroid->direction = dir % 360; // update rotation @@ -593,7 +593,7 @@ static void offscreenUpdate(DROID *psDroid, debug(LOG_MULTISYNC, "Moving droid %d from (%u,%u) to (%u,%u)", (int)psDroid->id, oldx, oldy, (UDWORD)fx, (UDWORD)fy); psDroid->pos.x = (UWORD)x; //update x psDroid->pos.y = (UWORD)y; //update y - gridMoveObject((BASE_OBJECT *)psDroid, (SDWORD)oldx,(SDWORD)oldy); + gridMoveDroid(psDroid, (SDWORD)oldx,(SDWORD)oldy); psDroid->direction = dir % 360; // update rotation }