From 396fe4d1063c9bb8af4b16d696c9d97ac022f85c Mon Sep 17 00:00:00 2001 From: Flugente Date: Tue, 14 Oct 2014 20:05:49 +0000 Subject: [PATCH] Fix: if sneaking undetected near an enemy, saving and reloading increased agility. git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@7569 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Tactical/Soldier Control.cpp | 48 ++++++++++++++++++------------------ 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/Tactical/Soldier Control.cpp b/Tactical/Soldier Control.cpp index 74c1f054..5f5d3307 100644 --- a/Tactical/Soldier Control.cpp +++ b/Tactical/Soldier Control.cpp @@ -4789,31 +4789,36 @@ void SOLDIERTYPE::SetSoldierGridNo( INT32 sNewGridNo, BOOLEAN fForceRemove ) } } - if ( this->bTeam == gbPlayerNum && this->bStealthMode ) + // Flugente: award agility stat increase if we sneak upon an enemy undetected + // do NOT award this bonus if we are currently loading a game - otherwise one could increase agility by repeatedly saving and reloading the game + if ( !(gTacticalStatus.uiFlags & LOADING_SAVED_GAME) ) { - // Merc got to a new tile by "sneaking". Did we theoretically sneak - // past an enemy? - - if ( this->aiData.bOppCnt > 0 ) // opponents in sight + if ( this->bTeam == gbPlayerNum && this->bStealthMode ) { - // check each possible enemy - for ( cnt = 0; cnt < MAX_NUM_SOLDIERS; cnt++ ) + // Merc got to a new tile by "sneaking". Did we theoretically sneak + // past an enemy? + + if ( this->aiData.bOppCnt > 0 ) // opponents in sight { - pEnemy = MercPtrs[cnt]; - // if this guy is here and alive enough to be looking for us - if ( pEnemy->bActive && pEnemy->bInSector && (pEnemy->stats.bLife >= OKLIFE) ) + // check each possible enemy + for ( cnt = 0; cnt < MAX_NUM_SOLDIERS; ++cnt ) { - // no points for sneaking by the neutrals & friendlies!!! - if ( !pEnemy->aiData.bNeutral && (this->bSide != pEnemy->bSide) && (pEnemy->ubBodyType != COW && pEnemy->ubBodyType != CROW) ) + pEnemy = MercPtrs[cnt]; + // if this guy is here and alive enough to be looking for us + if ( pEnemy->bActive && pEnemy->bInSector && (pEnemy->stats.bLife >= OKLIFE) ) { - // if we SEE this particular oppponent, and he DOESN'T see us... and he COULD see us... - if ( (this->aiData.bOppList[cnt] == SEEN_CURRENTLY) && - pEnemy->aiData.bOppList[this->ubID] != SEEN_CURRENTLY && - PythSpacesAway( this->sGridNo, pEnemy->sGridNo ) < pEnemy->GetMaxDistanceVisible( this->sGridNo, this->pathing.bLevel ) ) + // no points for sneaking by the neutrals & friendlies!!! + if ( !pEnemy->aiData.bNeutral && (this->bSide != pEnemy->bSide) && (pEnemy->ubBodyType != COW && pEnemy->ubBodyType != CROW) ) { - // AGILITY (5): Soldier snuck 1 square past unaware enemy - StatChange( this, AGILAMT, 5, FALSE ); - // Keep looping, we'll give'em 1 point for EACH such enemy! + // if we SEE this particular oppponent, and he DOESN'T see us... and he COULD see us... + if ( (this->aiData.bOppList[cnt] == SEEN_CURRENTLY) && + pEnemy->aiData.bOppList[this->ubID] != SEEN_CURRENTLY && + PythSpacesAway( this->sGridNo, pEnemy->sGridNo ) < pEnemy->GetMaxDistanceVisible( this->sGridNo, this->pathing.bLevel ) ) + { + // AGILITY (5): Soldier snuck 1 square past unaware enemy + StatChange( this, AGILAMT, 5, FALSE ); + // Keep looping, we'll give'em 1 point for EACH such enemy! + } } } } @@ -4823,11 +4828,6 @@ void SOLDIERTYPE::SetSoldierGridNo( INT32 sNewGridNo, BOOLEAN fForceRemove ) // Adjust speed based on terrain, etc SetSoldierAniSpeed( this ); - - } - else - { - //int breakpoint = 0; } }