Exploit fix: don't allow "apply item to others" cursor to reveal position of invisible enemy.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8976 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Sevenfm
2021-04-25 12:26:58 +00:00
parent c3e961731a
commit e23e473333
3 changed files with 29 additions and 70 deletions
+5 -14
View File
@@ -257,7 +257,6 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bLevel, UINT16 usHa
UINT16 usRaiseGunCost = 0;
UINT16 usTurningCost = 0;
// Remove any previous actions
pSoldier->aiData.ubPendingAction = NO_PENDING_ACTION;
@@ -300,12 +299,6 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bLevel, UINT16 usHa
gTacticalStatus.ubAttackBusyCount = 0;
}
// if ( pTargetSoldier )
// {
// pTargetSoldier->bBeingAttackedCount = 0;
// }
// Check our soldier's life for unconscious!
if ( pSoldier->stats.bLife < OKLIFE )
{
@@ -1476,8 +1469,11 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bLevel, UINT16 usHa
}
}
UINT8 ubPerson = WhoIsThere2(usMapPos, pSoldier->pathing.bLevel);
// Flugente: apply misc items to other soldiers
if ( ItemCanBeAppliedToOthers( usHandItem ) )
// sevenfm: check that target soldier is visible
if (ItemCanBeAppliedToOthers(usHandItem) && ubPerson != NOBODY && MercPtrs[ubPerson] && MercPtrs[ubPerson]->bVisible != 0)
{
// ATE: AI CANNOT GO THROUGH HERE!
BOOLEAN fHadToUseCursorPos = FALSE;
@@ -1499,12 +1495,7 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bLevel, UINT16 usHa
sAPCost = GetAPsToApplyItem( pSoldier, sActionGridNo );
sAPCost += PlotPath( pSoldier, sActionGridNo, NO_COPYROUTE, FALSE, TEMPORARY, (UINT16)pSoldier->usUIMovementMode, NOT_STEALTH, FORWARD, pSoldier->bActionPoints);
// if we are at the action gridno, the item is a bomb, but nobody is at the gridno, do not apply and do not return - we will plant the bomb instead (handlded later in this function)
if ( Item[ usHandItem ].usItemClass == IC_BOMB && WhoIsThere2( usMapPos, pSoldier->pathing.bLevel ) == NOBODY )
{
;
}
else if ( EnoughPoints( pSoldier, sAPCost, 0, fFromUI ) )
if ( EnoughPoints( pSoldier, sAPCost, 0, fFromUI ) )
{
// OK, set UI
SetUIBusy( pSoldier->ubID );