Fix FindBestNearbyCover() and delete global var (#156)

This commit is contained in:
rftrdev
2023-05-26 21:28:00 -07:00
committed by GitHub
parent f2ab296b49
commit 119c6fe6bb
6 changed files with 30 additions and 29 deletions
+4 -3
View File
@@ -3755,6 +3755,7 @@ void CheckTossSelfSmoke(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestThrow)
{
INT16 ubMinAPcost;
INT8 bGrenadeIn = NO_SLOT;
UINT32 uiThreatCnt = 0;
// initialize
pBestThrow->ubPossible = FALSE;
@@ -3771,7 +3772,7 @@ void CheckTossSelfSmoke(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestThrow)
bGrenadeIn = FindThrowableGrenade(pSoldier, EXPLOSV_SMOKE);
// prepare threat list for ClosestSeenThreatID(), ClosestKnownThreatID()
PrepareThreatlist(pSoldier);
uiThreatCnt = PrepareThreatlist(pSoldier);
if (bGrenadeIn != NO_SLOT)
{
@@ -3812,7 +3813,7 @@ void CheckTossSelfSmoke(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestThrow)
if (TileIsOutOfBounds(sTargetSpot))
{
ubClosestThreatID = ClosestSeenThreatID(pSoldier, SEEN_LAST_TURN);
ubClosestThreatID = ClosestSeenThreatID(pSoldier, uiThreatCnt, SEEN_LAST_TURN);
if (ubClosestThreatID != NOBODY &&
MercPtrs[ubClosestThreatID] &&
@@ -3826,7 +3827,7 @@ void CheckTossSelfSmoke(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestThrow)
if (TileIsOutOfBounds(sTargetSpot))
{
ubClosestThreatID = ClosestKnownThreatID(pSoldier);
ubClosestThreatID = ClosestKnownThreatID(pSoldier, uiThreatCnt);
if (ubClosestThreatID != NOBODY &&
MercPtrs[ubClosestThreatID] &&