Add hack to prevent droids from being stuck because path-finding does not

understand that very steep slopes cannot be crossed, and these slopes were 
not properly marked as cliffs in the map. Now droids can climb even the
steepest slope if not marked impassable, although slowly. This is the lesser 
evil (compared to getting stuck droids), since stuck AI droids will clog up 
path-finding for everyone.


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@4167 4a71c877-e1ca-e34f-864e-861f7616d084
master
Per Inge Mathisen 2008-03-20 15:50:28 +00:00
parent e3130c9c96
commit f6743c23d2
2 changed files with 11 additions and 13 deletions

View File

@ -144,19 +144,6 @@
// how far to move for a shuffle
#define SHUFFLE_MOVE (2*TILE_UNITS/2)
/***********************************************************************************/
/* Slope defines */
// angle after which the droid starts to turn back down a slope
#define SLOPE_TURN_ANGLE 50
// max and min ranges of roll for controlling how much to turn
#define SLOPE_MIN_ROLL 5
#define SLOPE_MAX_ROLL 30
// base amount to turn
#define SLOPE_DIR_CHANGE 20
/***********************************************************************************/
/* Tracked model defines */
@ -2060,6 +2047,13 @@ SDWORD moveCalcDroidSpeed(DROID *psDroid)
}
// now offset the speed for the slope of the droid
speed = (MAX_SPEED_PITCH - pitch) * speed / MAX_SPEED_PITCH;
if (speed <= 0)
{
// Very nasty hack to deal with buggy maps, where some cliffs are
// not properly marked as being cliffs, but too steep to drive over.
// This confuses the heck out of the path-finding code! - Per
speed = 10;
}
// slow down damaged droids
damLevel = PERCENT(psDroid->body, psDroid->originalBody);

View File

@ -77,6 +77,10 @@ extern void moveReallyStopDroid(DROID *psDroid);
/* Get a droid to do a frame's worth of moving */
extern void moveUpdateDroid(DROID *psDroid);
/**
* Calculate the new speed for a droid based on factors like damage and pitch.
* @todo Remove hack for steep slopes not properly marked as blocking on some maps.
*/
SDWORD moveCalcDroidSpeed(DROID *psDroid);
/* Frame update for the movement of a tracked droid */