diff --git a/SaveLoadGame.cpp b/SaveLoadGame.cpp index 38b49724..a434be2d 100644 --- a/SaveLoadGame.cpp +++ b/SaveLoadGame.cpp @@ -2913,20 +2913,7 @@ BOOLEAN SOLDIERTYPE::Load(HWFILE hFile) } // sevenfm: initialize other SOLDIERTYPE data - this->ubLastShock=0; - this->ubLastSuppression=0; - this->ubLastAP=0; - this->ubLastMorale=0; - this->ubLastShockFromHit=0; - this->ubLastAPFromHit=0; - this->ubLastMoraleFromHit=0; - this->iLastBulletImpact = 0; - this->iLastArmourProtection = 0; - - this->usQuickItemId = 0; - this->ubQuickItemSlot = 0; - - this->usGrenadeItem = 0; + this->InitializeExtraData(); return TRUE; } diff --git a/Tactical/Soldier Control.cpp b/Tactical/Soldier Control.cpp index b02135c4..f86558ea 100644 --- a/Tactical/Soldier Control.cpp +++ b/Tactical/Soldier Control.cpp @@ -1073,20 +1073,7 @@ SOLDIERTYPE& SOLDIERTYPE::operator=(const OLDSOLDIERTYPE_101& src) for ( UINT8 i = 0; i < SOLDIER_COUNTER_MAX; ++i ) this->usSkillCounter[i] = 0; for ( UINT8 i = 0; i < SOLDIER_COOLDOWN_MAX; ++i ) this->usSkillCooldown[i] = 0; - this->ubLastShock = 0; - this->ubLastSuppression = 0; - this->ubLastAP = 0; - this->ubLastMorale = 0; - this->ubLastShockFromHit = 0; - this->ubLastMoraleFromHit = 0; - this->ubLastAPFromHit = 0; - this->iLastBulletImpact = 0; - this->iLastArmourProtection = 0; - - this->usQuickItemId = 0; - this->ubQuickItemSlot = 0; - - this->usGrenadeItem = 0; + this->InitializeExtraData(); } return *this; } @@ -1150,19 +1137,7 @@ void SOLDIERTYPE::initialize( ) memset( &pathing, 0, sizeof(STRUCT_Pathing) ); // sevenfm:initialize additional data - this->ubLastShock = 0; - this->ubLastSuppression = 0; - this->ubLastAP = 0; - this->ubLastMorale = 0; - this->ubLastShockFromHit = 0; - this->ubLastMoraleFromHit = 0; - this->ubLastAPFromHit = 0; - this->iLastBulletImpact = 0; - this->iLastArmourProtection = 0; - this->usQuickItemId = 0; - this->ubQuickItemSlot = 0; - this->usDisabilityFlagMask = 0; - this->sDragGridNo = NOWHERE; + this->InitializeExtraData(); } bool SOLDIERTYPE::exists( ) @@ -26013,3 +25988,21 @@ void SOLDIERTYPE::StartRadioAnimation(void) break; } } + +void SOLDIERTYPE::InitializeExtraData(void) +{ + this->ubLastShock = 0; + this->ubLastSuppression = 0; + this->ubLastAP = 0; + this->ubLastMorale = 0; + this->ubLastShockFromHit = 0; + this->ubLastMoraleFromHit = 0; + this->ubLastAPFromHit = 0; + this->iLastBulletImpact = 0; + this->iLastArmourProtection = 0; + + this->usQuickItemId = 0; + this->ubQuickItemSlot = 0; + + this->usGrenadeItem = 0; +} diff --git a/Tactical/Soldier Control.h b/Tactical/Soldier Control.h index 742539dd..76f86371 100644 --- a/Tactical/Soldier Control.h +++ b/Tactical/Soldier Control.h @@ -1878,6 +1878,8 @@ public: void StartRadioAnimation(void); + void InitializeExtraData(void); + // Flugente: prisoner system BOOLEAN CanProcessPrisoners(); UINT32 GetSurrenderStrength(); diff --git a/Tactical/Soldier Create.cpp b/Tactical/Soldier Create.cpp index ebbfc239..ccff4ced 100644 --- a/Tactical/Soldier Create.cpp +++ b/Tactical/Soldier Create.cpp @@ -2118,20 +2118,10 @@ void InitSoldierStruct( SOLDIERTYPE *pSoldier ) pSoldier->usChatPartnerID = NOBODY; // sevenfm: initialize additional data - pSoldier->ubLastShock = 0; - pSoldier->ubLastSuppression = 0; - pSoldier->ubLastAP = 0; - pSoldier->ubLastMorale = 0; - pSoldier->ubLastShockFromHit = 0; - pSoldier->ubLastMoraleFromHit = 0; - pSoldier->ubLastAPFromHit = 0; - pSoldier->iLastBulletImpact = 0; - pSoldier->iLastArmourProtection = 0; + pSoldier->InitializeExtraData(); - pSoldier->usQuickItemId = 0; - pSoldier->ubQuickItemSlot = 0; - - pSoldier->usGrenadeItem = 0; + pSoldier->sDragGridNo = NOWHERE; + pSoldier->sFocusGridNo = NOWHERE; } diff --git a/Tactical/TeamTurns.cpp b/Tactical/TeamTurns.cpp index 1821b419..3ce16818 100644 --- a/Tactical/TeamTurns.cpp +++ b/Tactical/TeamTurns.cpp @@ -1804,6 +1804,9 @@ INT8 CalcInterruptDuelPts( SOLDIERTYPE * pSoldier, UINT8 ubOpponentID, BOOLEAN f UINT8 ubDistance; DebugMsg (TOPIC_JA2INTERRUPT,DBG_LEVEL_3,"CalcInterruptDuelPts"); + // sevenfm: safety check + Assert(pSoldier); + // extra check to make sure neutral folks never get interrupts if (pSoldier->aiData.bNeutral) { @@ -1846,7 +1849,8 @@ INT8 CalcInterruptDuelPts( SOLDIERTYPE * pSoldier, UINT8 ubOpponentID, BOOLEAN f } } - if (fUseWatchSpots) + // sevenfm: no watch spot bonus when focusing + if (fUseWatchSpots && !(pSoldier->usSoldierFlagMask2 & SOLDIER_TRAIT_FOCUS)) { // if this is a previously noted spot of enemies, give bonus points! iPoints += GetWatchedLocPoints( pSoldier->ubID, MercPtrs[ ubOpponentID ]->sGridNo, MercPtrs[ ubOpponentID ]->pathing.bLevel ); diff --git a/TileEngine/worldman.cpp b/TileEngine/worldman.cpp index 67d64e6e..d1de5e23 100644 --- a/TileEngine/worldman.cpp +++ b/TileEngine/worldman.cpp @@ -4112,7 +4112,7 @@ void UpdateTreeVisibility() // check trees near cursor position if (!TileIsOutOfBounds(usMouseSpot) && (PythSpacesAway(sSpot, usMouseSpot) <= 2 && AIDirection(sSpot, usMouseSpot) == 0 || - PythSpacesAway(sSpot, usMouseSpot) <= 5 && AIDirection(sSpot, usMouseSpot) == 7 || + PythSpacesAway(sSpot, usMouseSpot) <= 6 && AIDirection(sSpot, usMouseSpot) == 7 || PythSpacesAway(sSpot, usMouseSpot) <= 2 && AIDirection(sSpot, usMouseSpot) == 6)) { fHideTree = TRUE; @@ -4129,7 +4129,7 @@ void UpdateTreeVisibility() pOpponent->bVisible != -1 && !TileIsOutOfBounds(pOpponent->sGridNo) && (PythSpacesAway(sSpot, pOpponent->sGridNo) <= 2 && AIDirection(sSpot, pOpponent->sGridNo) == 0 || - PythSpacesAway(sSpot, pOpponent->sGridNo) <= 5 && AIDirection(sSpot, pOpponent->sGridNo) == 7 || + PythSpacesAway(sSpot, pOpponent->sGridNo) <= 6 && AIDirection(sSpot, pOpponent->sGridNo) == 7 || PythSpacesAway(sSpot, pOpponent->sGridNo) <= 2 && AIDirection(sSpot, pOpponent->sGridNo) == 6)) { fHideTree = TRUE;