From c45b5aa7f6bce67b2a9d4f3c5a49386f7b2c595e Mon Sep 17 00:00:00 2001 From: silversurfer Date: Tue, 18 Mar 2014 08:19:41 +0000 Subject: [PATCH] Fix for aim level calculations. Base weapon modifiers are now always applied except for shooting from hip. This fixes the problem that an optical attachment could remove base weapon modifiers completely and apply a bonus on top of that. git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@7084 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Tactical/Items.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Tactical/Items.cpp b/Tactical/Items.cpp index f6328af8a..c107d3522 100644 --- a/Tactical/Items.cpp +++ b/Tactical/Items.cpp @@ -10291,8 +10291,12 @@ INT32 GetObjectModifier( SOLDIERTYPE* pSoldier, OBJECTTYPE *pObj, UINT8 ubStance GetScopeLists(pObj, ObjList); // only use scope mode if gun is in hand, otherwise an error might occur! - if ( (&pSoldier->inv[HANDPOS]) == pObj && ObjList[pSoldier->bScopeMode] != NULL ) - iModifier += GetItemModifier(ObjList[pSoldier->bScopeMode], ubRef, usType); + if ( (&pSoldier->inv[HANDPOS]) == pObj && ObjList[pSoldier->bScopeMode] != NULL ) + // Do not apply weapon bonus/penalty because this will be added one step below. We don't want to apply it twice. + if ( pObj->usItem != ObjList[pSoldier->bScopeMode]->usItem ) + iModifier += GetItemModifier(ObjList[pSoldier->bScopeMode], ubRef, usType); + // add weapon modifier + iModifier += GetItemModifier( pObj, ubRef, usType); } } else