Backport from path branch: Fix sMove->DestinationX|Y to use world coordinates, as they should be.

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5342 4a71c877-e1ca-e34f-864e-861f7616d084
master
Per Inge Mathisen 2008-06-28 15:25:58 +00:00
parent 238e9664a2
commit a8dc963d37
3 changed files with 9 additions and 9 deletions

View File

@ -563,8 +563,8 @@ static FP_NODE *psNearest, *psRoute;
psCurr = psCurr->psRoute;
}
psMove->numPoints = index;
psMove->DestinationX = psMove->asPath[index - 1].x;
psMove->DestinationY = psMove->asPath[index - 1].y;
psMove->DestinationX = world_coord(psMove->asPath[index - 1].x);
psMove->DestinationY = world_coord(psMove->asPath[index - 1].y);
}
else
{

View File

@ -316,15 +316,14 @@ void moveUpdateBaseSpeed(void)
}
}
/** Set a target location for a droid to move to
/** Set a target location in world coordinates for a droid to move to
* @return true if the routing was succesful, if false then the calling code
* should not try to route here again for a while
* @todo Document what "should not try to route here again for a while" means.
*/
static BOOL moveDroidToBase(DROID *psDroid, UDWORD x, UDWORD y, BOOL bFormation)
static BOOL moveDroidToBase(DROID *psDroid, UDWORD x, UDWORD y, BOOL bFormation)
{
FPATH_RETVAL retVal = FPR_OK;
SDWORD fmx1,fmy1, fmx2,fmy2;
CHECK_DROID(psDroid);
@ -393,6 +392,8 @@ static BOOL moveDroidToBase(DROID *psDroid, UDWORD x, UDWORD y, BOOL bFormation)
{
// join a formation if it exists at the destination
FORMATION* psFormation = formationFind(x, y);
SDWORD fmx1, fmy1, fmx2, fmy2;
if (psFormation)
{
psDroid->sMove.psFormation = psFormation;
@ -1096,7 +1097,7 @@ static BOOL moveBlocked(DROID *psDroid)
map_coord(psDroid->sMove.DestinationX), map_coord(psDroid->sMove.DestinationY)))
{
objTrace(psDroid->id, "Trying to reroute to (%d,%d)", psDroid->sMove.DestinationX, psDroid->sMove.DestinationY);
moveDroidTo(psDroid, world_coord(psDroid->sMove.DestinationX), world_coord(psDroid->sMove.DestinationY));
moveDroidTo(psDroid, psDroid->sMove.DestinationX, psDroid->sMove.DestinationY);
return false;
}

View File

@ -32,9 +32,8 @@ typedef struct _move_control
UBYTE Status; // Inactive, Navigating or moving point to point status
UBYTE Position; // Position in asPath
UBYTE numPoints; // number of points in asPath
Vector2i *asPath; // Pointer to list of block X,Y coordinates.
SDWORD DestinationX; // DestinationX,Y should match objects current X,Y
SDWORD DestinationY; // location for this movement to be complete.
Vector2i *asPath; // Pointer to list of block X,Y map coordinates.
SDWORD DestinationX, DestinationY; // World coordinates of movement destination
SDWORD srcX,srcY,targetX,targetY;
/* Stuff for John's movement update */