mirror of
https://github.com/1dot13/source.git
synced 2026-09-02 14:36:06 +02:00
[~] Performance optimizations around Attachment[] and Launchable[] arrays
AIMNAS with its ~50K elements in Attachment[] suffered of performance drop when MOLLE stuff is in the visible inventory. To resolve it the following is done: * Introduce gMAXATTACHMENTS_READ with actual number of elements in Attachment[]; according refactoring. * Introduce gMAXLAUNCHABLES_READ with actual number of elements in Launchable[]; according refactoring. * Introduce std::multimap AttachmentBackmap for quick access to attachments using itemId as a key. * Sort Attachment[] by attachmentIndex right after loading from XML. According order in XML is not needed anymore. * Introduce FindAttachmentRange() for quick access to attachments using attachmentId as a key (binary search in Attachment[]). In a few words, GetHelpTextForItemInLaptop(), ValidAttachment(), SetAttachmentSlotsFlag() were heavily optimized.
This commit is contained in:
@@ -568,6 +568,7 @@ INT32 GetPercentRangeBonus( OBJECTTYPE * pObj );
|
||||
UINT8 GetInventorySleepModifier( SOLDIERTYPE *pSoldier );
|
||||
|
||||
void AttachDefaultAttachments(OBJECTTYPE *pObj, BOOLEAN fAllDefaultAttachments=TRUE);//dnl ch75 261013
|
||||
BOOLEAN FindAttachmentRange(UINT16 usAttachment, UINT32* pStartIndex, UINT32* pEndIndex);
|
||||
|
||||
// Flugente: is this object useable by militia?
|
||||
BOOLEAN ObjectIsMilitiaRelevant( OBJECTTYPE *pObj );
|
||||
|
||||
Reference in New Issue
Block a user