Brief: //dnl ch76

- Debug performance improvement when working with inventory and UDB.
Details:
- Open UDB was quite slow and then clicking at some attachment slots halted game for few seconds.
- Moving mouse over opened inventory slots with hundreds of items jerking and halting mouse for moment.
- Fix CTD in rare occasions after attach and then remove GL and try attach some improper attachment.


git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@6570 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Kriplo
2013-11-09 20:49:40 +00:00
parent 12d65e8eba
commit 4104fbb248
2 changed files with 49 additions and 12 deletions
+4 -3
View File
@@ -2267,8 +2267,8 @@ BOOLEAN ValidItemAttachmentSlot( OBJECTTYPE * pObj, UINT16 usAttachment, BOOLEAN
BOOLEAN fSimilarItems = FALSE, fSameItem = FALSE, fNoSpace = FALSE;
UINT16 usSimilarItem = NOTHING;
INT16 ubSlotIndex = 0;
INT32 iLoop2 = 0;
INT16 sTimesToRun = 0;
// INT32 iLoop2 = 0;
// INT16 sTimesToRun = 0;
UINT8 curSlot = 0;
UINT8 ubVolumeTaken;
BOOLEAN foundValidAttachment = FALSE;
@@ -2324,7 +2324,8 @@ BOOLEAN ValidItemAttachmentSlot( OBJECTTYPE * pObj, UINT16 usAttachment, BOOLEAN
//Do we want to check all attachment slots or just the one in slotcount?
if(slotCount == -1){
//Loop through slots
for(UINT8 curSlot = 0; curSlot < (*pObj)[subObject]->attachments.size() && !foundValidAttachment; curSlot++){
UINT32 uiSlots = min((*pObj)[subObject]->attachments.size(), usAttachmentSlotIndexVector.size());//dnl??? ch76 091113 ugly fix as AK74 after attach/remove GL will have more attachments then usAttachmentSlotIndexVector which lead to CTD
for(UINT8 curSlot = 0; curSlot < uiSlots && !foundValidAttachment; curSlot++){
//Any attachment that is already in this slot will go here.
OBJECTTYPE * pAttachment;