* Make static array aDirOffset const
* Rewrite the Doxygen comment for fpathUpdate() * Some style fixes git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@4648 4a71c877-e1ca-e34f-864e-861f7616d084master
parent
12ff794e99
commit
a855f10f4e
26
src/fpath.c
26
src/fpath.c
|
@ -50,7 +50,7 @@
|
|||
#define NUM_DIR 8
|
||||
// Convert a direction into an offset
|
||||
// dir 0 => x = 0, y = -1
|
||||
static Vector2i aDirOffset[NUM_DIR] =
|
||||
static const Vector2i aDirOffset[NUM_DIR] =
|
||||
{
|
||||
{ 0, 1},
|
||||
{-1, 1},
|
||||
|
@ -91,13 +91,17 @@ BOOL fpathInitialise(void)
|
|||
return true;
|
||||
}
|
||||
|
||||
// update routine for the findpath system
|
||||
/** Updates the pathfinding system.
|
||||
* @post Pathfinding jobs for objects that died, aren't waiting for a route
|
||||
* anymore, or the currently calculated route is outdated for, are
|
||||
* removed from the job queue.
|
||||
*/
|
||||
void fpathUpdate(void)
|
||||
{
|
||||
if ((psPartialRouteObj != NULL) &&
|
||||
((psPartialRouteObj->died) ||
|
||||
(((DROID*)psPartialRouteObj)->sMove.Status != MOVEWAITROUTE) ||
|
||||
((lastPartialFrame + 5) < (SDWORD)frameGetFrameNumber()) ) )
|
||||
if (psPartialRouteObj != NULL
|
||||
&& (psPartialRouteObj->died
|
||||
|| ((DROID*)psPartialRouteObj)->sMove.Status != MOVEWAITROUTE
|
||||
|| (lastPartialFrame + 5) < frameGetFrameNumber()))
|
||||
{
|
||||
psPartialRouteObj = NULL;
|
||||
}
|
||||
|
@ -796,12 +800,12 @@ static BOOL fpathFindRoute(DROID *psDroid, SDWORD sX,SDWORD sY, SDWORD tX,SDWORD
|
|||
}
|
||||
|
||||
// now look for a unit in this formation with a route that can be used
|
||||
for(psCurr = apsDroidLists[psDroid->player]; psCurr; psCurr = psCurr->psNext)
|
||||
for (psCurr = apsDroidLists[psDroid->player]; psCurr; psCurr = psCurr->psNext)
|
||||
{
|
||||
if ((psCurr != psDroid) &&
|
||||
(psCurr != (DROID *)psPartialRouteObj) &&
|
||||
(psCurr->sMove.psFormation == psFormation) &&
|
||||
(psCurr->sMove.numPoints > 0))
|
||||
if (psCurr != psDroid
|
||||
&& psCurr != (DROID *)psPartialRouteObj
|
||||
&& psCurr->sMove.psFormation == psFormation
|
||||
&& psCurr->sMove.numPoints > 0)
|
||||
{
|
||||
// find the first route point
|
||||
if (!fpathFindFirstRoutePoint(&psCurr->sMove, &index, sX,sY, (SDWORD)psCurr->pos.x, (SDWORD)psCurr->pos.y))
|
||||
|
|
|
@ -40,11 +40,6 @@ typedef enum _fpath_retval
|
|||
/** Initialise the path-finding module. */
|
||||
extern BOOL fpathInitialise(void);
|
||||
|
||||
/**
|
||||
* Update the findpath system each frame. It checks whether a game object has a
|
||||
* path-finding job that was not finished in the previous frame, and if this
|
||||
* game object is dead, remove it from the job queue.
|
||||
*/
|
||||
extern void fpathUpdate(void);
|
||||
|
||||
/** Find a route for an object to a location. */
|
||||
|
|
Loading…
Reference in New Issue