mirror of
https://github.com/1dot13/source.git
synced 2026-08-05 14:00:23 +02:00
- Fix: external iInitialMercArrivalLocation was overwritten by value from savegame
- Fix: gridno outside of map is used as valid map gridno git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8104 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -202,7 +202,8 @@ INT8 CalcBestCTGT( SOLDIERTYPE *pSoldier, UINT8 ubOppID, INT32 sOppGridNo, INT8
|
||||
|
||||
// using only ints for maximum execution speed here
|
||||
// CJC: Well, so much for THAT idea!
|
||||
INT32 sCentralGridNo, sAdjSpot, sNorthGridNo, sSouthGridNo, sCheckSpot, sOKTest;
|
||||
INT32 sCentralGridNo, sAdjSpot, sNorthGridNo, sSouthGridNo, sCheckSpot;
|
||||
BOOLEAN sOKTest;
|
||||
|
||||
INT8 bThisCTGT, bBestCTGT = 0;
|
||||
|
||||
@@ -218,7 +219,7 @@ INT8 CalcBestCTGT( SOLDIERTYPE *pSoldier, UINT8 ubOppID, INT32 sOppGridNo, INT8
|
||||
|
||||
// look into all 8 adjacent tiles & determine where the cover is the worst
|
||||
// Lalien: shouldn't this start at 0 than?
|
||||
for (UINT8 sDir = 0; sDir < NUM_WORLD_DIRECTIONS; sDir++)
|
||||
for (UINT8 sDir = 0; sDir < NUM_WORLD_DIRECTIONS; ++sDir)
|
||||
{
|
||||
// get the gridno of the adjacent spot lying in that direction
|
||||
sAdjSpot = NewGridNo( sCentralGridNo, DirectionInc( sDir ) );
|
||||
@@ -227,7 +228,7 @@ INT8 CalcBestCTGT( SOLDIERTYPE *pSoldier, UINT8 ubOppID, INT32 sOppGridNo, INT8
|
||||
if (sAdjSpot != sCentralGridNo)
|
||||
{
|
||||
// if the adjacent spot can we walked on and isn't in water or gas
|
||||
if ((NewOKDestination( pSoldier, sAdjSpot, IGNOREPEOPLE, bLevel ) > 0) && !InWaterOrGas( pSoldier, sAdjSpot ))
|
||||
if ( NewOKDestination( pSoldier, sAdjSpot, IGNOREPEOPLE, bLevel ) && !InWaterOrGas( pSoldier, sAdjSpot ))
|
||||
{
|
||||
switch (sDir)
|
||||
{
|
||||
|
||||
@@ -289,7 +289,7 @@ INT8 PointPatrolAI(SOLDIERTYPE *pSoldier)
|
||||
{
|
||||
sPatrolPoint = NextPatrolPoint(pSoldier);
|
||||
}
|
||||
while (( !TileIsOutOfBounds(sPatrolPoint)) && (NewOKDestination(pSoldier,sPatrolPoint,IGNOREPEOPLE, pSoldier->pathing.bLevel) < 1));
|
||||
while (( !TileIsOutOfBounds(sPatrolPoint)) && !NewOKDestination(pSoldier,sPatrolPoint,IGNOREPEOPLE, pSoldier->pathing.bLevel) );
|
||||
|
||||
// if we're back where we started, then ALL other patrol points are junk!
|
||||
if (pSoldier->sGridNo == sPatrolPoint)
|
||||
@@ -373,7 +373,7 @@ INT8 RandomPointPatrolAI(SOLDIERTYPE *pSoldier)
|
||||
sPatrolPoint = pSoldier->aiData.sPatrolGrid[ bPatrolIndex];
|
||||
bCnt++;
|
||||
}
|
||||
while ( (sPatrolPoint == pSoldier->sGridNo) || ( (!TileIsOutOfBounds(sPatrolPoint)) && (bCnt < pSoldier->aiData.bPatrolCnt) && (NewOKDestination(pSoldier,sPatrolPoint,IGNOREPEOPLE, pSoldier->pathing.bLevel ) < 1)) );
|
||||
while ( (sPatrolPoint == pSoldier->sGridNo) || ( (!TileIsOutOfBounds(sPatrolPoint)) && (bCnt < pSoldier->aiData.bPatrolCnt) && !NewOKDestination(pSoldier,sPatrolPoint,IGNOREPEOPLE, pSoldier->pathing.bLevel )) );
|
||||
|
||||
if (bCnt == pSoldier->aiData.bPatrolCnt)
|
||||
{
|
||||
@@ -383,7 +383,7 @@ INT8 RandomPointPatrolAI(SOLDIERTYPE *pSoldier)
|
||||
{
|
||||
sPatrolPoint = NextPatrolPoint(pSoldier);
|
||||
}
|
||||
while ((!TileIsOutOfBounds(sPatrolPoint)) && (NewOKDestination(pSoldier,sPatrolPoint,IGNOREPEOPLE, pSoldier->pathing.bLevel) < 1));
|
||||
while ((!TileIsOutOfBounds(sPatrolPoint)) && !NewOKDestination(pSoldier,sPatrolPoint,IGNOREPEOPLE, pSoldier->pathing.bLevel) );
|
||||
}
|
||||
|
||||
// do nothing this time around
|
||||
|
||||
Reference in New Issue
Block a user