Speed up inventory rendering by avoiding unnecessary function calls

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8394 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Flugente
2017-03-11 15:35:39 +00:00
parent 125fda3905
commit c2b3d1a5a0
4 changed files with 145 additions and 228 deletions
+15 -6
View File
@@ -2733,9 +2733,7 @@ void INVRenderINVPanelItem( SOLDIERTYPE *pSoldier, INT16 sPocket, UINT8 fDirtyLe
RenderPocketItemCapacity( guiSAVEBUFFER, itemSlotLimit, sPocket, pSoldier, &pSoldier->inv[sPocket], sX, sY );
if ( itemSlotLimit == 0 )
{
fHatchItOut = TRUE;
}
}
// CHRISL: Change whether we hatch a pocket to be dependant on the current item
@@ -2743,8 +2741,10 @@ void INVRenderINVPanelItem( SOLDIERTYPE *pSoldier, INT16 sPocket, UINT8 fDirtyLe
{
fHatchItOut = FALSE;
}
else if (!UsingNewAttachmentSystem( ) && !ValidAttachment( gpItemPointer->usItem, pObject ) ||
(UsingNewAttachmentSystem( ) && !ValidItemAttachmentSlot( pObject, gpItemPointer->usItem, FALSE, FALSE )) )
// Flugente: we call this function a lot, so only call if necessary
else if ( !fHatchItOut && (
!UsingNewAttachmentSystem( ) && !ValidAttachment( gpItemPointer->usItem, pObject ) ||
(UsingNewAttachmentSystem( ) && !ValidItemAttachmentSlot( pObject, gpItemPointer->usItem, FALSE, FALSE )) ) )
{
fHatchItOut = TRUE;
}
@@ -2915,12 +2915,21 @@ void HandleAnyMercInSquadHasCompatibleStuff( UINT8 ubSquad, OBJECTTYPE *pObject,
BOOLEAN IsMutuallyValidAttachmentOrLaunchable(UINT16 usAttItem, UINT16 usItem)//dnl ch76 091113
{
UINT32 uiLoop = 0;
while(Attachment[uiLoop][0] | Launchable[uiLoop][0])
while ( Attachment[uiLoop][0] )
{
if(Attachment[uiLoop][0] == usAttItem && Attachment[uiLoop][1] == usItem || Attachment[uiLoop][0] == usItem && Attachment[uiLoop][1] == usAttItem || Launchable[uiLoop][0] == usAttItem && Launchable[uiLoop][1] == usItem || Launchable[uiLoop][0] == usItem && Launchable[uiLoop][1] == usAttItem)
if(Attachment[uiLoop][0] == usAttItem && Attachment[uiLoop][1] == usItem || Attachment[uiLoop][0] == usItem && Attachment[uiLoop][1] == usAttItem )
return(TRUE);
++uiLoop;
}
uiLoop = 0;
while ( Launchable[uiLoop][0] )
{
if ( Launchable[uiLoop][0] == usAttItem && Launchable[uiLoop][1] == usItem || Launchable[uiLoop][0] == usItem && Launchable[uiLoop][1] == usAttItem )
return(TRUE);
++uiLoop;
}
return(FALSE);
}