When picking a tile based on a given start coordinate, make sure the result coordinate is on
the same continent as the start coordinate. This hopefully fixes ticket:1385 git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@9112 4a71c877-e1ca-e34f-864e-861f7616d084master
parent
b1f7e8ba17
commit
35c3ef9d35
14
src/droid.c
14
src/droid.c
|
@ -3646,10 +3646,10 @@ BOOL pickATileGen(UDWORD *x, UDWORD *y, UBYTE numIterations,
|
||||||
BOOL pickATileGenThreat(UDWORD *x, UDWORD *y, UBYTE numIterations, SDWORD threatRange,
|
BOOL pickATileGenThreat(UDWORD *x, UDWORD *y, UBYTE numIterations, SDWORD threatRange,
|
||||||
SDWORD player, BOOL (*function)(UDWORD x, UDWORD y))
|
SDWORD player, BOOL (*function)(UDWORD x, UDWORD y))
|
||||||
{
|
{
|
||||||
SDWORD i,j;
|
SDWORD i, j;
|
||||||
SDWORD startX,endX,startY,endY;
|
SDWORD startX, endX, startY, endY;
|
||||||
UDWORD passes;
|
UDWORD passes;
|
||||||
|
Vector2i origin = { *x, *y };
|
||||||
|
|
||||||
ASSERT_OR_RETURN(false, *x<mapWidth,"x coordinate is off-map for pickATileGen" );
|
ASSERT_OR_RETURN(false, *x<mapWidth,"x coordinate is off-map for pickATileGen" );
|
||||||
ASSERT_OR_RETURN(false, *y<mapHeight,"y coordinate is off-map for pickATileGen" );
|
ASSERT_OR_RETURN(false, *y<mapHeight,"y coordinate is off-map for pickATileGen" );
|
||||||
|
@ -3673,8 +3673,12 @@ UDWORD passes;
|
||||||
/* Test only perimeter as internal tested previous iteration */
|
/* Test only perimeter as internal tested previous iteration */
|
||||||
if(i==startX || i==endX || j==startY || j==endY)
|
if(i==startX || i==endX || j==startY || j==endY)
|
||||||
{
|
{
|
||||||
|
Vector2i newPos = { i, j };
|
||||||
|
|
||||||
/* Good enough? */
|
/* Good enough? */
|
||||||
if(function(i,j) && ((threatRange <=0) || (!ThreatInRange(player, threatRange, world_coord(i), world_coord(j), false)))) //TODO: vtols check really not needed?
|
if (function(i, j)
|
||||||
|
&& fpathCheck(origin, newPos, PROPULSION_TYPE_WHEELED)
|
||||||
|
&& ((threatRange <= 0) || (!ThreatInRange(player, threatRange, world_coord(i), world_coord(j), false))))
|
||||||
{
|
{
|
||||||
/* Set exit conditions and get out NOW */
|
/* Set exit conditions and get out NOW */
|
||||||
*x = i; *y = j;
|
*x = i; *y = j;
|
||||||
|
|
Loading…
Reference in New Issue