mirror of
https://github.com/ladislav-zezula/StormLib.git
synced 2026-02-04 13:26:35 +01:00
+ Fixed patching bug
This commit is contained in:
@@ -175,26 +175,30 @@ static bool FileWasFoundBefore(
|
||||
|
||||
static TFileEntry * FindPatchEntry(TMPQArchive * ha, TFileEntry * pFileEntry)
|
||||
{
|
||||
TFileEntry * pPatchEntry = NULL;
|
||||
TFileEntry * pPatchEntry = pFileEntry;
|
||||
TFileEntry * pTempEntry;
|
||||
char szFileName[MAX_PATH+1];
|
||||
|
||||
// Go while there are patches
|
||||
while(ha->haPatch != NULL)
|
||||
// Can't find patch entry for a file that doesn't have name
|
||||
if(pFileEntry->szFileName != NULL && pFileEntry->szFileName[0] != 0)
|
||||
{
|
||||
// Move to the patch archive
|
||||
ha = ha->haPatch;
|
||||
szFileName[0] = 0;
|
||||
// Go while there are patches
|
||||
while(ha->haPatch != NULL)
|
||||
{
|
||||
// Move to the patch archive
|
||||
ha = ha->haPatch;
|
||||
szFileName[0] = 0;
|
||||
|
||||
// Prepare the prefix for the file name
|
||||
if(ha->pPatchPrefix != NULL)
|
||||
StringCopyA(szFileName, ha->pPatchPrefix->szPatchPrefix, MAX_PATH);
|
||||
StringCatA(szFileName, pFileEntry->szFileName, MAX_PATH);
|
||||
// Prepare the prefix for the file name
|
||||
if(ha->pPatchPrefix != NULL)
|
||||
StringCopyA(szFileName, ha->pPatchPrefix->szPatchPrefix, MAX_PATH);
|
||||
StringCatA(szFileName, pFileEntry->szFileName, MAX_PATH);
|
||||
|
||||
// Try to find the file there
|
||||
pTempEntry = GetFileEntryExact(ha, szFileName, 0, NULL);
|
||||
if(pTempEntry != NULL)
|
||||
pPatchEntry = pTempEntry;
|
||||
// Try to find the file there
|
||||
pTempEntry = GetFileEntryExact(ha, szFileName, 0, NULL);
|
||||
if(pTempEntry != NULL)
|
||||
pPatchEntry = pTempEntry;
|
||||
}
|
||||
}
|
||||
|
||||
// Return the found patch entry
|
||||
@@ -225,9 +229,8 @@ static bool DoMPQSearch_FileEntry(
|
||||
// DebugBreak();
|
||||
|
||||
// Find a patch to this file
|
||||
// Note: This either succeeds or returns pFileEntry
|
||||
pPatchEntry = FindPatchEntry(ha, pFileEntry);
|
||||
if(pPatchEntry == NULL)
|
||||
pPatchEntry = pFileEntry;
|
||||
|
||||
// Prepare the block index
|
||||
dwBlockIndex = (DWORD)(pFileEntry - ha->pFileTable);
|
||||
|
||||
Reference in New Issue
Block a user