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:
Flugente
2014-01-26 12:18:43 +00:00
parent d4aa35a66e
commit d6186aca15
34 changed files with 677 additions and 643 deletions
+9 -8
View File
@@ -2803,7 +2803,7 @@ BOOLEAN AddDeadSoldierToUnLoadedSector( INT16 sMapX, INT16 sMapY, UINT8 bMapZ, S
{
UINT32 uiNumberOfItems;
std::vector<WORLDITEM> pWorldItems;//dnl ch75 271013
UINT i;
UINT8 i;
UINT8 bCount=0;
UINT16 uiFlagsForWorldItems=0;
UINT16 usFlagsForRottingCorpse=0;
@@ -2837,7 +2837,8 @@ BOOLEAN AddDeadSoldierToUnLoadedSector( INT16 sMapX, INT16 sMapY, UINT8 bMapZ, S
//go through and and find out how many items there are
uiNumberOfItems = 0;
for ( i = 0; i < pSoldier->inv.size(); i++ )
UINT8 invsize = pSoldier->inv.size();
for ( i = 0; i < invsize; ++i )
{
if( pSoldier->inv[ i ].exists() == true )
{
@@ -2855,8 +2856,7 @@ BOOLEAN AddDeadSoldierToUnLoadedSector( INT16 sMapX, INT16 sMapY, UINT8 bMapZ, S
//if the item can be dropped
if( !( pSoldier->inv[ i ].fFlags & OBJECT_UNDROPPABLE ) || pSoldier->bTeam == gbPlayerNum )
{
uiNumberOfItems++;
++uiNumberOfItems;
}
}
}
@@ -2875,7 +2875,7 @@ BOOLEAN AddDeadSoldierToUnLoadedSector( INT16 sMapX, INT16 sMapY, UINT8 bMapZ, S
//loop through all the soldiers items and add them to the world item array
bCount = 0;
for ( i = 0; i < pSoldier->inv.size(); i++ )
for ( i = 0; i < invsize; ++i )
{
if( pSoldier->inv[ i ].exists() == true )
{
@@ -2897,7 +2897,7 @@ BOOLEAN AddDeadSoldierToUnLoadedSector( INT16 sMapX, INT16 sMapY, UINT8 bMapZ, S
pSoldier->inv[i][0]->data.objectStatus = max(pSoldier->inv[i][0]->data.objectStatus,1); // never below 1%
}
pWorldItems[ bCount ].object = pSoldier->inv[i];
bCount++;
++bCount;
}
}
}
@@ -2907,7 +2907,7 @@ BOOLEAN AddDeadSoldierToUnLoadedSector( INT16 sMapX, INT16 sMapY, UINT8 bMapZ, S
//CHRISL: Now that we've copied the dead soldiers items to pWorldItems, we need to actually remove the items from the dead soldier. Otherwise we have
// actually duplicated the items and there's a chance that these duplicated items will again find their way to sector.
for ( i = 0; i < pSoldier->inv.size(); i++ )
for ( i = 0; i < invsize; ++i )
{
if( pSoldier->inv[ i ].exists() == true )
{
@@ -3002,7 +3002,8 @@ UINT32 LBENODEChecksum( LBENODE * pNode )
uiChecksum *= (pNode->lbeIndex +1);
uiChecksum += (pNode->ubID +1);
for ( uiLoop = 0; uiLoop < pNode->inv.size(); uiLoop++ )
UINT32 invsize = pNode->inv.size();
for ( uiLoop = 0; uiLoop < invsize; ++uiLoop )
{
uiChecksum += pNode->inv[ uiLoop ].usItem;
}