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
+9 -1
View File
@@ -9,6 +9,9 @@
#include "XML.h"
#endif
// Flugente: in order not to loop over MAXATTACHMENTS entries in IncompatibleAttachments[] if we only have a few thousand, remember the actual number read in
UINT32 gINCOMPATIBLEATTACHMENTS_READ = 0;
struct
{
PARSE_STAGE curElement;
@@ -91,6 +94,9 @@ incompatibleattachmentEndElementHandle(void *userData, const XML_Char *name)
{
pData->curElement = ELEMENT_LIST;
// Flugente: new entry
gINCOMPATIBLEATTACHMENTS_READ = pData->curIndex;
if(pData->curIndex < pData->maxArraySize)
{
//DebugMsg(TOPIC_JA2, DBG_LEVEL_3,"IncompatibleAttachmentStartElementHandle: writing incompatibleattachment to array");
@@ -172,8 +178,10 @@ BOOLEAN ReadInIncompatibleAttachmentStats(STR fileName)
return FALSE;
}
MemFree(lpcBuffer);
// read was x -> x+1 entries
++gINCOMPATIBLEATTACHMENTS_READ;
MemFree(lpcBuffer);
XML_ParserFree(parser);