diff --git a/Tactical/Turn Based Input.cpp b/Tactical/Turn Based Input.cpp index 397dabb6..1a37e044 100644 --- a/Tactical/Turn Based Input.cpp +++ b/Tactical/Turn Based Input.cpp @@ -3083,13 +3083,13 @@ void GetKeyboardInput( UINT32 *puiNewEvent ) if ( OK_CONTROLLABLE_MERC( pTeamSoldier ) && pTeamSoldier->bAssignment == CurrentSquad( ) && !AM_A_ROBOT( pTeamSoldier ) ) { - // Search for gun + // Search for gun in soldier inventory for (UINT32 bLoop2 = 0; bLoop2 < NUM_INV_SLOTS; bLoop2++) { - if (Item[pTeamSoldier->inv[bLoop2].usItem].usItemClass & IC_GUN || Item[pTeamSoldier->inv[bLoop2].usItem].usItemClass == IC_LAUNCHER) + if ( (Item[pTeamSoldier->inv[bLoop2].usItem].usItemClass & IC_GUN) || (Item[pTeamSoldier->inv[bLoop2].usItem].usItemClass == IC_LAUNCHER) ) { pGun = &(pTeamSoldier->inv[bLoop2]); - //magazine is not full + //if magazine is not full if ( pGun->ubGunShotsLeft < GetMagSize( pGun ) ) { @@ -3134,7 +3134,7 @@ void GetKeyboardInput( UINT32 *puiNewEvent ) { if ( OK_CONTROLLABLE_MERC( pTeamSoldier ) && pTeamSoldier->bAssignment == CurrentSquad( ) && !AM_A_ROBOT( pTeamSoldier ) ) { - if (Item[pTeamSoldier->inv[HANDPOS].usItem].usItemClass & IC_GUN || Item[pTeamSoldier->inv[HANDPOS].usItem].usItemClass == IC_LAUNCHER) + if ( (Item[pTeamSoldier->inv[HANDPOS].usItem].usItemClass & IC_GUN) || (Item[pTeamSoldier->inv[HANDPOS].usItem].usItemClass == IC_LAUNCHER) ) { pGun = &(pTeamSoldier->inv[HANDPOS]); @@ -3204,21 +3204,30 @@ void GetKeyboardInput( UINT32 *puiNewEvent ) INT8 ubSlotLimit = ItemSlotLimit( gWorldItems[ uiLoop ].o.usItem, BIGPOCK1POS ); //if we still have some space - if ( gWorldItems[ uiLoop ].o.ubNumberOfObjects < ubSlotLimit ) + INT32 i = 0; + while ( gWorldItems[ uiLoop ].o.ubNumberOfObjects < ubSlotLimit ) { + i++; //if the next item is the same - if ( gWorldItems[ uiLoop ].o.usItem == gWorldItems[ uiLoop + 1 ].o.usItem ) + if ( gWorldItems[ uiLoop ].o.usItem == gWorldItems[ uiLoop + i ].o.usItem ) { INT8 ubObjCount = ubSlotLimit - gWorldItems[ uiLoop ].o.ubNumberOfObjects; - INT8 bPointsToMove = __min( ubObjCount, gWorldItems[ uiLoop +1 ].o.ubNumberOfObjects ); + INT8 bPointsToMove = __min( ubObjCount, gWorldItems[ uiLoop + i ].o.ubNumberOfObjects ); - StackObjs( &(gWorldItems[ uiLoop +1 ].o), &(gWorldItems[ uiLoop ].o), bPointsToMove); + StackObjs( &(gWorldItems[ uiLoop + i ].o), &(gWorldItems[ uiLoop ].o), bPointsToMove); + + } + else + { + break; } } } } } break; + + case 's': if( fCtrl )