| 174 | } |
| 175 | |
| 176 | static 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 | |
| 208 | static bool DoMPQSearch_FileEntry( |
| 209 | TMPQSearch * hs, |
no test coverage detected