Permalink
Browse files

Extend movement API to pass type of movement info to path-finder. Pat…

…ch reviewed by stiv.
  • Loading branch information...
perim committed Jun 12, 2011
1 parent 94c9430 commit 316272bdaf262bad78f746e3935497ac277ac20d
Showing with 9 additions and 8 deletions.
  1. +6 −6 src/move.cpp
  2. +3 −2 src/move.h
View
@@ -221,7 +221,7 @@ void moveUpdateBaseSpeed(void)
* 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_MOVETYPE moveType)
{
FPATH_RETVAL retVal = FPR_OK;
@@ -242,7 +242,7 @@ static bool moveDroidToBase(DROID *psDroid, UDWORD x, UDWORD y, bool bFormation)
}
else
{
- retVal = fpathDroidRoute(psDroid, x, y, FMT_MOVE);
+ retVal = fpathDroidRoute(psDroid, x, y, moveType);
}
if ( retVal == FPR_OK )
@@ -282,18 +282,18 @@ static bool moveDroidToBase(DROID *psDroid, UDWORD x, UDWORD y, bool bFormation)
/** Move a droid to a location, joining a formation
* @see moveDroidToBase() for the parameter and return value specification
*/
-bool moveDroidTo(DROID* psDroid, UDWORD x, UDWORD y)
+bool moveDroidTo(DROID* psDroid, UDWORD x, UDWORD y, FPATH_MOVETYPE moveType)
{
- return moveDroidToBase(psDroid,x,y, true);
+ return moveDroidToBase(psDroid, x, y, true, moveType);
}
/** Move a droid to a location, not joining a formation
* @see moveDroidToBase() for the parameter and return value specification
*/
-bool moveDroidToNoFormation(DROID* psDroid, UDWORD x, UDWORD y)
+bool moveDroidToNoFormation(DROID* psDroid, UDWORD x, UDWORD y, FPATH_MOVETYPE moveType)
{
ASSERT(x > 0 && y > 0, "Bad movement position");
- return moveDroidToBase(psDroid,x,y, false);
+ return moveDroidToBase(psDroid, x, y, false, moveType);
}
View
@@ -25,6 +25,7 @@
#define __INCLUDED_SRC_MOVE_H__
#include "objectdef.h"
+#include "fpath.h"
/* Initialise the movement system */
extern bool moveInitialise(void);
@@ -33,11 +34,11 @@ extern bool moveInitialise(void);
extern void moveUpdateBaseSpeed(void);
/* Set a target location for a droid to move to - returns a bool based on if there is a path to the destination (true if there is a path)*/
-extern bool moveDroidTo(DROID *psDroid, UDWORD x, UDWORD y);
+extern bool moveDroidTo(DROID *psDroid, UDWORD x, UDWORD y, FPATH_MOVETYPE moveType = FMT_MOVE);
/* Set a target location for a droid to move to - returns a bool based on if there is a path to the destination (true if there is a path)*/
// the droid will not join a formation when it gets to the location
-extern bool moveDroidToNoFormation(DROID *psDroid, UDWORD x, UDWORD y);
+extern bool moveDroidToNoFormation(DROID *psDroid, UDWORD x, UDWORD y, FPATH_MOVETYPE moveType = FMT_MOVE);
// move a droid directly to a location (used by vtols only)
extern void moveDroidToDirect(DROID *psDroid, UDWORD x, UDWORD y);

0 comments on commit 316272b

Please sign in to comment.