From d6820d6ef051ce448ccc593d578bff3e2ed1cd57 Mon Sep 17 00:00:00 2001 From: lalien Date: Sun, 14 May 2006 17:26:20 +0000 Subject: [PATCH] Little Alien - Rearrange sector inventory changed git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@70 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Tactical/Turn Based Input.cpp | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) 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 )