MCPcopy Create free account
hub / github.com/diasurgical/devilution / GetMpqFileCount

Function GetMpqFileCount

3rdParty/StormLib/src/SFileGetFileInfo.cpp:45–70  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

43
44
45static DWORD GetMpqFileCount(TMPQArchive * ha)
46{
47 TFileEntry * pFileTableEnd;
48 TFileEntry * pFileEntry;
49 DWORD dwFileCount = 0;
50
51 // Go through all open MPQs, including patches
52 while(ha != NULL)
53 {
54 // Only count files that are not patch files
55 pFileTableEnd = ha->pFileTable + ha->dwFileTableSize;
56 for(pFileEntry = ha->pFileTable; pFileEntry < pFileTableEnd; pFileEntry++)
57 {
58 // If the file is patch file and this is not primary archive, skip it
59 // BUGBUG: This errorneously counts non-patch files that are in both
60 // base MPQ and in patches, and increases the number of files by cca 50%
61 if((pFileEntry->dwFlags & (MPQ_FILE_EXISTS | MPQ_FILE_PATCH_FILE)) == MPQ_FILE_EXISTS)
62 dwFileCount++;
63 }
64
65 // Move to the next patch archive
66 ha = ha->haPatch;
67 }
68
69 return dwFileCount;
70}
71
72static bool GetFilePatchChain(TMPQFile * hf, void * pvFileInfo, DWORD cbFileInfo, DWORD * pcbLengthNeeded)
73{

Callers 1

SFileGetFileInfoFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected