mirror of
https://github.com/1dot13/source.git
synced 2026-08-05 14:00:23 +02:00
Merged revision(s) 7251 from branches/ja2_source_official_2014:
code cleanup & removed some warnings git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@7252 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
+43
-43
@@ -41,14 +41,14 @@ int LegalNPCDestination(SOLDIERTYPE *pSoldier, INT32 sGridNo, UINT8 ubPathMode,
|
||||
if ((sGridNo < 0) || (sGridNo >= GRIDSIZE))
|
||||
{
|
||||
#ifdef RECORDNET
|
||||
fprintf(NetDebugFile,"LegalNPC->pathing.sDestination: ERROR - rcvd invalid gridno %d",GridNo);
|
||||
fprintf(NetDebugFile,"LegalNPC->pathing.sDestination: ERROR - rcvd invalid gridno %d",GridNo);
|
||||
#endif
|
||||
|
||||
#ifdef BETAVERSION
|
||||
NumMessage("LegalNPC->pathing.sDestination: ERROR - rcvd invalid gridno ",GridNo);
|
||||
NumMessage("LegalNPC->pathing.sDestination: ERROR - rcvd invalid gridno ",GridNo);
|
||||
#endif
|
||||
|
||||
return(FALSE);
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
//dnl ch53 121009 Return false if gridno on different level from merc or inside unvisible area
|
||||
@@ -58,33 +58,32 @@ int LegalNPCDestination(SOLDIERTYPE *pSoldier, INT32 sGridNo, UINT8 ubPathMode,
|
||||
// skip mercs if turnbased and adjacent AND not doing an IGNORE_PATH check (which is used almost exclusively by GoAsFarAsPossibleTowards)
|
||||
fSkipTilesWithMercs = (gfTurnBasedAI && ubPathMode != IGNORE_PATH && SpacesAway( pSoldier->sGridNo, sGridNo ) == 1 );
|
||||
|
||||
// if this gridno is an OK destination
|
||||
// AND the gridno is NOT in a tear-gassed tile when we have no gas mask
|
||||
// AND someone is NOT already standing there
|
||||
// AND we're NOT already standing at that gridno
|
||||
// AND the gridno hasn't been black-listed for us
|
||||
// if this gridno is an OK destination
|
||||
// AND the gridno is NOT in a tear-gassed tile when we have no gas mask
|
||||
// AND someone is NOT already standing there
|
||||
// AND we're NOT already standing at that gridno
|
||||
// AND the gridno hasn't been black-listed for us
|
||||
|
||||
// Nov 28 98: skip people in destination tile if in turnbased
|
||||
if ( ( NewOKDestination(pSoldier, sGridNo, fSkipTilesWithMercs, pSoldier->pathing.bLevel ) ) &&
|
||||
// Nov 28 98: skip people in destination tile if in turnbased
|
||||
if ( ( NewOKDestination(pSoldier, sGridNo, fSkipTilesWithMercs, pSoldier->pathing.bLevel ) ) &&
|
||||
( !InGas( pSoldier, sGridNo ) ) &&
|
||||
( sGridNo != pSoldier->sGridNo ) &&
|
||||
( sGridNo != pSoldier->pathing.sBlackList ) )
|
||||
/*
|
||||
if ( ( NewOKDestination(pSoldier, sGridno, FALSE, pSoldier->pathing.bLevel ) ) &&
|
||||
( !(gpWorldLevelData[ sGridno ].ubExtFlags[0] & (MAPELEMENT_EXT_SMOKE | MAPELEMENT_EXT_TEARGAS | MAPELEMENT_EXT_MUSTARDGAS)) || ( pSoldier->inv[ HEAD1POS ].usItem == GASMASK || pSoldier->inv[ HEAD2POS ].usItem == GASMASK ) ) &&
|
||||
( sGridno != pSoldier->sGridNo ) &&
|
||||
( sGridno != pSoldier->pathing.sBlackList ) )*/
|
||||
/*
|
||||
if ( ( NewOKDestination(pSoldier,sGridno,ALLPEOPLE, pSoldier->pathing.bLevel ) ) &&
|
||||
( !(gpWorldLevelData[ sGridno ].ubExtFlags[0] & (MAPELEMENT_EXT_SMOKE | MAPELEMENT_EXT_TEARGAS | MAPELEMENT_EXT_MUSTARDGAS)) || ( pSoldier->inv[ HEAD1POS ].usItem == GASMASK || pSoldier->inv[ HEAD2POS ].usItem == GASMASK ) ) &&
|
||||
( sGridno != pSoldier->sGridNo ) &&
|
||||
( sGridno != pSoldier->pathing.sBlackList ) )
|
||||
*/
|
||||
/*
|
||||
if ( ( NewOKDestination(pSoldier, sGridno, FALSE, pSoldier->pathing.bLevel ) ) &&
|
||||
( !(gpWorldLevelData[ sGridno ].ubExtFlags[0] & (MAPELEMENT_EXT_SMOKE | MAPELEMENT_EXT_TEARGAS | MAPELEMENT_EXT_MUSTARDGAS)) || ( pSoldier->inv[ HEAD1POS ].usItem == GASMASK || pSoldier->inv[ HEAD2POS ].usItem == GASMASK ) ) &&
|
||||
( sGridno != pSoldier->sGridNo ) &&
|
||||
( sGridno != pSoldier->pathing.sBlackList ) )*/
|
||||
/*
|
||||
if ( ( NewOKDestination(pSoldier,sGridno,ALLPEOPLE, pSoldier->pathing.bLevel ) ) &&
|
||||
( !(gpWorldLevelData[ sGridno ].ubExtFlags[0] & (MAPELEMENT_EXT_SMOKE | MAPELEMENT_EXT_TEARGAS | MAPELEMENT_EXT_MUSTARDGAS)) || ( pSoldier->inv[ HEAD1POS ].usItem == GASMASK || pSoldier->inv[ HEAD2POS ].usItem == GASMASK ) ) &&
|
||||
( sGridno != pSoldier->sGridNo ) &&
|
||||
( sGridno != pSoldier->pathing.sBlackList ) )
|
||||
*/
|
||||
{
|
||||
|
||||
// if water's a problem, and gridno is in a water tile (bridges are OK)
|
||||
// if water's a problem, and gridno is in a water tile (bridges are OK)
|
||||
if (!ubWaterOK && Water(sGridNo))
|
||||
return(FALSE);
|
||||
return(FALSE);
|
||||
|
||||
//Madd: added to prevent people from running into gas and fire
|
||||
if ( (gpWorldLevelData[sGridNo].ubExtFlags[pSoldier->pathing.bLevel] & (MAPELEMENT_EXT_TEARGAS | MAPELEMENT_EXT_MUSTARDGAS)) &&
|
||||
@@ -97,34 +96,35 @@ int LegalNPCDestination(SOLDIERTYPE *pSoldier, INT32 sGridNo, UINT8 ubPathMode,
|
||||
return( FALSE );
|
||||
}
|
||||
|
||||
// passed all checks, now try to make sure we can get there!
|
||||
switch (ubPathMode)
|
||||
{
|
||||
// if finding a path wasn't asked for (could have already been done,
|
||||
// for example), don't bother
|
||||
case IGNORE_PATH : return(TRUE);
|
||||
|
||||
// passed all checks, now try to make sure we can get there!
|
||||
switch (ubPathMode)
|
||||
{
|
||||
// if finding a path wasn't asked for (could have already been done,
|
||||
// for example), don't bother
|
||||
case IGNORE_PATH : return(TRUE);
|
||||
case ENSURE_PATH : if ( FindBestPath( pSoldier, sGridNo, pSoldier->pathing.bLevel, WALKING, COPYROUTE, fFlags ) )
|
||||
{
|
||||
return(TRUE); // legal destination
|
||||
}
|
||||
else // got this far, but found no clear path,
|
||||
{
|
||||
// so test fails
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
case ENSURE_PATH : if ( FindBestPath( pSoldier, sGridNo, pSoldier->pathing.bLevel, WALKING, COPYROUTE, fFlags ) )
|
||||
{
|
||||
return(TRUE); // legal destination
|
||||
}
|
||||
else // got this far, but found no clear path,
|
||||
{
|
||||
// so test fails
|
||||
return(FALSE);
|
||||
}
|
||||
// *** NOTE: movement mode hardcoded to WALKING !!!!!
|
||||
// *** NOTE: movement mode hardcoded to WALKING !!!!!
|
||||
case ENSURE_PATH_COST: return(PlotPath(pSoldier,sGridNo,FALSE,FALSE,FALSE,WALKING,FALSE,FALSE,0));
|
||||
|
||||
default :
|
||||
default :
|
||||
#ifdef BETAVERSION
|
||||
NumMessage("LegalNPC->pathing.sDestination: ERROR - illegal pathMode = ",ubPathMode);
|
||||
#endif
|
||||
return(FALSE);
|
||||
}
|
||||
}
|
||||
}
|
||||
else // something failed - didn't even have to test path
|
||||
|
||||
// something failed - didn't even have to test path
|
||||
return(FALSE); // illegal destination
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user