diff --git a/Tactical/Drugs And Alcohol.cpp b/Tactical/Drugs And Alcohol.cpp index e58be6d8d..ec752aad1 100644 --- a/Tactical/Drugs And Alcohol.cpp +++ b/Tactical/Drugs And Alcohol.cpp @@ -259,8 +259,6 @@ void HandleEndTurnDrugAdjustments( SOLDIERTYPE *pSoldier ) // We test for every 'pure' drug separately for (cnt = DRUG_TYPE_ADRENALINE; cnt < DRUG_TYPE_MAX; ++cnt) { - UINT32 drugtestflag = (1 << cnt); // comparing with this flag will determine the drug - // omit DRUG_TYPE_REGENERATION, because that is checked afterwards separately if ( cnt == DRUG_TYPE_REGENERATION ) continue; diff --git a/Tactical/Weapons.cpp b/Tactical/Weapons.cpp index 7e76b358d..ef44fd94b 100644 --- a/Tactical/Weapons.cpp +++ b/Tactical/Weapons.cpp @@ -4990,7 +4990,11 @@ UINT32 CalcNewChanceToHitGun(SOLDIERTYPE *pSoldier, INT32 sGridNo, INT16 ubAimTi } // Flugente: moved trait modifiers into a member function - iTraitModifier = pSoldier->GetTraitCTHModifier( usInHand, ubAimTime, pTarget->ubProfile ); + UINT8 targetprofile = NOBODY; + if ( pTarget && pTarget->ubProfile != NOBODY ) + targetprofile = pTarget->ubProfile; + + iTraitModifier = pSoldier->GetTraitCTHModifier( usInHand, ubAimTime, targetprofile ); // SHOOTING AT SAME TARGET AGAIN if (sGridNo == pSoldier->sLastTarget ) @@ -6459,7 +6463,11 @@ UINT32 CalcChanceToHitGun(SOLDIERTYPE *pSoldier, INT32 sGridNo, INT16 ubAimTime, ///////////////////////////////////////////////////////////////////////////////////// // Modify for traits // Flugente: moved trait modifiers into a member function - iChance += pSoldier->GetTraitCTHModifier( usInHand, ubAimTime, pTarget->ubProfile ); + UINT8 targetprofile = NOBODY; + if ( pTarget && pTarget->ubProfile != NOBODY ) + targetprofile = pTarget->ubProfile; + + iChance += pSoldier->GetTraitCTHModifier( usInHand, ubAimTime, targetprofile ); /////////////////////////////////////////////////////////////////////////////////////