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
This commit is contained in:
lalien
2006-05-14 17:26:20 +00:00
parent cebf24fb8e
commit d6820d6ef0
+17 -8
View File
@@ -3083,13 +3083,13 @@ void GetKeyboardInput( UINT32 *puiNewEvent )
if ( OK_CONTROLLABLE_MERC( pTeamSoldier ) && pTeamSoldier->bAssignment == CurrentSquad( ) && !AM_A_ROBOT( pTeamSoldier ) ) 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++) 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]); pGun = &(pTeamSoldier->inv[bLoop2]);
//magazine is not full //if magazine is not full
if ( pGun->ubGunShotsLeft < GetMagSize( pGun ) ) 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 ( 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]); pGun = &(pTeamSoldier->inv[HANDPOS]);
@@ -3204,21 +3204,30 @@ void GetKeyboardInput( UINT32 *puiNewEvent )
INT8 ubSlotLimit = ItemSlotLimit( gWorldItems[ uiLoop ].o.usItem, BIGPOCK1POS ); INT8 ubSlotLimit = ItemSlotLimit( gWorldItems[ uiLoop ].o.usItem, BIGPOCK1POS );
//if we still have some space //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 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 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; break;
case 's': case 's':
if( fCtrl ) if( fCtrl )