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

Function FindPatchEntry

3rdParty/StormLib/src/SFileFindFile.cpp:176–206  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

174}
175
176static TFileEntry * FindPatchEntry(TMPQArchive * ha, TFileEntry * pFileEntry)
177{
178 TFileEntry * pPatchEntry = pFileEntry;
179 TFileEntry * pTempEntry;
180 char szFileName[MAX_PATH+1];
181
182 // Can't find patch entry for a file that doesn't have name
183 if(pFileEntry->szFileName != NULL && pFileEntry->szFileName[0] != 0)
184 {
185 // Go while there are patches
186 while(ha->haPatch != NULL)
187 {
188 // Move to the patch archive
189 ha = ha->haPatch;
190 szFileName[0] = 0;
191
192 // Prepare the prefix for the file name
193 if(ha->pPatchPrefix && ha->pPatchPrefix->nLength)
194 StringCopy(szFileName, _countof(szFileName), ha->pPatchPrefix->szPatchPrefix);
195 StringCat(szFileName, _countof(szFileName), pFileEntry->szFileName);
196
197 // Try to find the file there
198 pTempEntry = GetFileEntryExact(ha, szFileName, 0, NULL);
199 if(pTempEntry != NULL)
200 pPatchEntry = pTempEntry;
201 }
202 }
203
204 // Return the found patch entry
205 return pPatchEntry;
206}
207
208static bool DoMPQSearch_FileEntry(
209 TMPQSearch * hs,

Callers 1

DoMPQSearch_FileEntryFunction · 0.85

Calls 3

StringCopyFunction · 0.85
StringCatFunction · 0.85
GetFileEntryExactFunction · 0.85

Tested by

no test coverage detected