CalcChanceToHitGun, CalcNewChanceToHitGun: set fCantSeeTarget = true when shooting at empty invisible tile

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8301 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Sevenfm
2016-09-14 07:07:40 +00:00
parent 17ce3e4473
commit e7fe040722
+15 -6
View File
@@ -5313,12 +5313,19 @@ UINT32 CalcNewChanceToHitGun(SOLDIERTYPE *pSoldier, INT32 sGridNo, INT16 ubAimTi
iSightRange = 0;
if (ubTargetID != NOBODY && pSoldier->aiData.bOppList[ubTargetID] == SEEN_CURRENTLY || gbPublicOpplist[pSoldier->bTeam][ubTargetID] == SEEN_CURRENTLY)
{
iSightRange = SoldierToSoldierLineOfSightTest( pSoldier, MercPtrs[ubTargetID], TRUE, NO_DISTANCE_LIMIT, pSoldier->bAimShotLocation, false );
if (iSightRange == 0) { // didn't do a bodypart-based test or can't see specific body part aimed at
}
if (iSightRange == 0)
{
// didn't do a bodypart-based test or can't see specific body part aimed at
iSightRange = SoldierTo3DLocationLineOfSightTest( pSoldier, sGridNo, pSoldier->bTargetLevel, pSoldier->bTargetCubeLevel, TRUE, NO_DISTANCE_LIMIT, false );
}
if (ubTargetID != NOBODY && iSightRange == 0) { // Can't see the target but we still need to know what the sight range would be if we could so we can deal with cover penalties
iSightRange = SoldierToSoldierLineOfSightTest( pSoldier, MercPtrs[ubTargetID], TRUE, NO_DISTANCE_LIMIT, pSoldier->bAimShotLocation, false, true );
if (iSightRange == 0)
{
// Can't see the target but we still need to know what the sight range would be if we could so we can deal with cover penalties
if (ubTargetID != NOBODY)
iSightRange = SoldierToSoldierLineOfSightTest( pSoldier, MercPtrs[ubTargetID], TRUE, NO_DISTANCE_LIMIT, pSoldier->bAimShotLocation, false, true );
fCantSeeTarget = true;
}
@@ -5672,9 +5679,11 @@ UINT32 CalcChanceToHitGun(SOLDIERTYPE *pSoldier, INT32 sGridNo, INT16 ubAimTime,
fCoverObscured = true;
}
if (ubTargetID != NOBODY && iSightRange == 0 )
{ // Can't see the target but we still need to know what the sight range would be if we could so we can deal with cover penalties
iSightRange = SoldierToSoldierLineOfSightTest( pSoldier, MercPtrs[ubTargetID], TRUE, NO_DISTANCE_LIMIT, pSoldier->bAimShotLocation, false, true );
if (iSightRange == 0 )
{
// Can't see the target but we still need to know what the sight range would be if we could so we can deal with cover penalties
if (ubTargetID != NOBODY)
iSightRange = SoldierToSoldierLineOfSightTest( pSoldier, MercPtrs[ubTargetID], TRUE, NO_DISTANCE_LIMIT, pSoldier->bAimShotLocation, false, true );
fCantSeeTarget = true;
fCoverObscured = false;
}