mirror of
https://github.com/1dot13/source.git
synced 2026-09-02 14:36:06 +02:00
Merged revision(s) 6826-6828 from branches/ja2_source_official_2014:
- Minor code improvements and cleanup - Fix from r6775 is no longer necessary. - Code improvement: Instead of calling inv.size() repeatedly, just call it once and remember that value git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@6829 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -1585,12 +1585,13 @@ BOOLEAN DisplayMercsInventory(UINT8 ubMercID)
|
||||
|
||||
//tais: disable Weaponbox Mouseregions to stop crashing when changing kit selection and hovering over item
|
||||
//tooltips for weaponbox
|
||||
for(i=0;i<WEAPONBOX_TOTAL_ITEMS;i++)
|
||||
for(i=0;i<WEAPONBOX_TOTAL_ITEMS; ++i)
|
||||
{
|
||||
MSYS_DisableRegion(&gWeaponboxFasthelpRegion[i]);
|
||||
}
|
||||
|
||||
for(i=0; i<gMercProfiles[ubMercID].inv.size(); i++)
|
||||
UINT8 invsize = gMercProfiles[ubMercID].inv.size();
|
||||
for(i=0; i<invsize; ++i)
|
||||
{
|
||||
usItem = gMercProfiles[ubMercID].inv[ i ];
|
||||
|
||||
@@ -1665,7 +1666,8 @@ BOOLEAN DisplayMercsInventory(UINT8 ubMercID)
|
||||
PosX = WEAPONBOX_X+3; // + 3 ( 1 to take care of the shadow, +2 to get past the weapon box border )
|
||||
PosY = WEAPONBOX_Y;
|
||||
|
||||
for(i=0; i<gMercProfiles[ubMercID].inv.size(); i++)
|
||||
UINT8 invsize = gMercProfiles[ubMercID].inv.size();
|
||||
for(i=0; i<invsize; ++i)
|
||||
{
|
||||
usItem = gMercProfiles[ubMercID].inv[ i ];
|
||||
|
||||
@@ -5930,7 +5932,8 @@ void WeaponKitSelectionUpdate(UINT8 selectedInventory = 0)
|
||||
gMercProfiles[gbCurrentSoldier].bMainGunAttractiveness = -1;
|
||||
gMercProfiles[gbCurrentSoldier].bArmourAttractiveness = -1;
|
||||
|
||||
for ( uiLoop = 0; uiLoop < gMercProfiles[gbCurrentSoldier].inv.size(); uiLoop++ )
|
||||
UINT32 invsize = gMercProfiles[ gbCurrentSoldier ].inv.size();
|
||||
for ( uiLoop = 0; uiLoop < invsize; ++uiLoop )
|
||||
{
|
||||
usItem = gMercProfiles[gbCurrentSoldier].inv[ uiLoop ];
|
||||
|
||||
@@ -5959,7 +5962,8 @@ void WeaponKitSelectionUpdate(UINT8 selectedInventory = 0)
|
||||
else
|
||||
{
|
||||
UINT16 tempGearCost = 0;
|
||||
for ( uiLoop = 0; uiLoop< gMercProfiles[ gbCurrentSoldier ].inv.size(); uiLoop++ )
|
||||
UINT32 invsize = gMercProfiles[ gbCurrentSoldier ].inv.size();
|
||||
for ( uiLoop = 0; uiLoop< invsize; ++uiLoop )
|
||||
{
|
||||
if ( gMercProfiles[ gbCurrentSoldier ].inv[ uiLoop ] != NOTHING )
|
||||
{
|
||||
|
||||
@@ -3648,14 +3648,14 @@ UINT8 CheckPlayersInventoryForGunMatchingGivenAmmoID( INT16 sItemID )
|
||||
UINT8 ubFirstID = gTacticalStatus.Team[ OUR_TEAM ].bFirstID;
|
||||
UINT8 ubLastID = gTacticalStatus.Team[ OUR_TEAM ].bLastID;
|
||||
|
||||
|
||||
//loop through all the mercs on the team
|
||||
for( ubMercCount = ubFirstID; ubMercCount <= ubLastID; ubMercCount++ )
|
||||
for( ubMercCount = ubFirstID; ubMercCount <= ubLastID; ++ubMercCount )
|
||||
{
|
||||
if( Menptr[ ubMercCount ].bActive )
|
||||
{
|
||||
//loop through all the pockets on the merc
|
||||
for( ubPocketCount=0; ubPocketCount<Menptr[ ubMercCount ].inv.size(); ubPocketCount++)
|
||||
UINT8 invsize = Menptr[ ubMercCount ].inv.size();
|
||||
for( ubPocketCount=0; ubPocketCount<invsize; ++ubPocketCount)
|
||||
{
|
||||
//if there is a weapon here
|
||||
if( Item[ Menptr[ ubMercCount ].inv[ ubPocketCount ].usItem ].usItemClass == IC_GUN )
|
||||
@@ -3663,7 +3663,7 @@ UINT8 CheckPlayersInventoryForGunMatchingGivenAmmoID( INT16 sItemID )
|
||||
//if the weapon uses the same kind of ammo as the one passed in, return true
|
||||
if( Weapon[ Menptr[ ubMercCount ].inv[ ubPocketCount ].usItem ].ubCalibre == Magazine[ Item[ sItemID ].ubClassIndex ].ubCalibre )
|
||||
{
|
||||
ubItemCount++;
|
||||
++ubItemCount;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1622,7 +1622,8 @@ BOOLEAN DisplayMERCMercsInventory(UINT8 ubMercID)
|
||||
MSYS_DisableRegion(&gMercWeaponboxFasthelpRegion[i]);
|
||||
}
|
||||
|
||||
for(i=0; i<gMercProfiles[ubMercID].inv.size(); i++)
|
||||
UINT8 invsize = gMercProfiles[ ubMercID ].inv.size();
|
||||
for(i=0; i<invsize; ++i)
|
||||
{
|
||||
usItem = gMercProfiles[ubMercID].inv[ i ];
|
||||
|
||||
@@ -1807,7 +1808,8 @@ void MercWeaponKitSelectionUpdate(UINT8 selectedInventory)
|
||||
gMercProfiles[ubMercID].bMainGunAttractiveness = -1;
|
||||
gMercProfiles[ubMercID].bArmourAttractiveness = -1;
|
||||
|
||||
for ( uiLoop = 0; uiLoop < gMercProfiles[ubMercID].inv.size(); uiLoop++ )
|
||||
UINT32 invsize = gMercProfiles[ ubMercID ].inv.size();
|
||||
for ( uiLoop = 0; uiLoop < invsize; ++uiLoop )
|
||||
{
|
||||
usItem = gMercProfiles[ubMercID].inv[ uiLoop ];
|
||||
|
||||
@@ -1838,7 +1840,8 @@ void MercWeaponKitSelectionUpdate(UINT8 selectedInventory)
|
||||
else
|
||||
{
|
||||
UINT16 tempGearCost = 0;
|
||||
for ( uiLoop = 0; uiLoop< gMercProfiles[ ubMercID ].inv.size(); uiLoop++ )
|
||||
UINT32 invsize = gMercProfiles[ ubMercID ].inv.size();
|
||||
for ( uiLoop = 0; uiLoop< invsize; ++uiLoop )
|
||||
{
|
||||
if ( gMercProfiles[ ubMercID ].inv[ uiLoop ] != NOTHING )
|
||||
{
|
||||
|
||||
+13
-11
@@ -2528,7 +2528,8 @@ void RenderInventoryForCharacter( INT32 iId, INT32 iSlot )
|
||||
return;
|
||||
}
|
||||
|
||||
for( ubCounter = 0; ubCounter < pSoldier->inv.size(); ubCounter++ )
|
||||
UINT8 invsize = pSoldier->inv.size();
|
||||
for( ubCounter = 0; ubCounter < invsize; ++ubCounter )
|
||||
{
|
||||
PosX = iScreenWidthOffset + 397 + 3;
|
||||
PosY = iScreenHeightOffset + 200 + 8 +( ubItemCount * ( 29 ) );
|
||||
@@ -2543,7 +2544,7 @@ void RenderInventoryForCharacter( INT32 iId, INT32 iSlot )
|
||||
{
|
||||
if( uiCurrentInventoryIndex > ubUpToCount )
|
||||
{
|
||||
ubUpToCount++;
|
||||
++ubUpToCount;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2778,21 +2779,20 @@ void EnableDisableInventoryScrollButtons( void )
|
||||
INT32 GetNumberOfInventoryItemsOnCurrentMerc( void )
|
||||
{
|
||||
// in current team mode?..nope...move on
|
||||
if (!fCurrentTeamMode) {
|
||||
if (!fCurrentTeamMode)
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
SOLDIERTYPE *pSoldier = &Menptr[currentTeamList[currentTeamIndex]];
|
||||
|
||||
unsigned ubCount = 0;
|
||||
for (unsigned ubCounter = 0; ubCounter < pSoldier->inv.size(); ++ubCounter)
|
||||
INT32 ubCount = 0;
|
||||
UINT8 invsize = pSoldier->inv.size();
|
||||
for (UINT8 ubCounter = 0; ubCounter < invsize; ++ubCounter)
|
||||
{
|
||||
if( ( pSoldier->inv[ ubCounter ].exists() == true) ) {
|
||||
if( ( pSoldier->inv[ ubCounter ].exists() == true) )
|
||||
++ubCount;
|
||||
}
|
||||
}
|
||||
|
||||
return (INT32)ubCount;
|
||||
return ubCount;
|
||||
}
|
||||
|
||||
void CreateDestroyPersonnelInventoryScrollButtons( void )
|
||||
@@ -6225,7 +6225,8 @@ INT32 GetFundsOnMerc( SOLDIERTYPE *pSoldier )
|
||||
}
|
||||
|
||||
// run through grunts pockets and count all the spare change
|
||||
for( iCurrentPocket = 0; iCurrentPocket < pSoldier->inv.size(); iCurrentPocket++ )
|
||||
UINT32 invsize = pSoldier->inv.size();
|
||||
for( iCurrentPocket = 0; iCurrentPocket < invsize; ++iCurrentPocket )
|
||||
{
|
||||
if ( Item[ pSoldier->inv[ iCurrentPocket ] .usItem ].usItemClass == IC_MONEY )
|
||||
{
|
||||
@@ -6249,7 +6250,8 @@ BOOLEAN TransferFundsFromMercToBank( SOLDIERTYPE *pSoldier, INT32 iCurrentBalanc
|
||||
UINT32 iCurrentPocket = 0;
|
||||
INT32 iAmountLeftToTake = iCurrentBalance;
|
||||
// run through grunts pockets and count all the spare change
|
||||
for( iCurrentPocket = 0; iCurrentPocket < pSoldier->inv.size(); iCurrentPocket++ )
|
||||
UINT32 invsize = pSoldier->inv.size();
|
||||
for( iCurrentPocket = 0; iCurrentPocket < invsize; ++iCurrentPocket )
|
||||
{
|
||||
if ( Item[ pSoldier->inv[ iCurrentPocket ] .usItem ].usItemClass == IC_MONEY )
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user