Skip to content

Commit

Permalink
Fix file check in CResource (Fixes multitheftauto#3201, PR multitheft…
Browse files Browse the repository at this point in the history
  • Loading branch information
W3lac3 authored Oct 8, 2023
1 parent 6615436 commit 2846e27
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions Server/mods/deathmatch/logic/CResource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -602,31 +602,31 @@ bool CResource::HasResourceChanged()

for (CResourceFile* pResourceFile : m_ResourceFiles)
{
if (GetFilePath(pResourceFile->GetName(), strPath))
{
CChecksum checksum = CChecksum::GenerateChecksumFromFileUnsafe(strPath);
if (!GetFilePath(pResourceFile->GetName(), strPath))
return true;

if (pResourceFile->GetLastChecksum() != checksum)
return true;
CChecksum checksum = CChecksum::GenerateChecksumFromFileUnsafe(strPath);

// Also check if file in http cache has been externally altered
switch (pResourceFile->GetType())
if (pResourceFile->GetLastChecksum() != checksum)
return true;

// Also check if file in http cache has been externally altered
switch (pResourceFile->GetType())
{
case CResourceFile::RESOURCE_FILE_TYPE_CLIENT_SCRIPT:
case CResourceFile::RESOURCE_FILE_TYPE_CLIENT_CONFIG:
case CResourceFile::RESOURCE_FILE_TYPE_CLIENT_FILE:
{
case CResourceFile::RESOURCE_FILE_TYPE_CLIENT_SCRIPT:
case CResourceFile::RESOURCE_FILE_TYPE_CLIENT_CONFIG:
case CResourceFile::RESOURCE_FILE_TYPE_CLIENT_FILE:
{
string strCachedFilePath = pResourceFile->GetCachedPathFilename();
CChecksum cachedChecksum = CChecksum::GenerateChecksumFromFileUnsafe(strCachedFilePath);
string strCachedFilePath = pResourceFile->GetCachedPathFilename();
CChecksum cachedChecksum = CChecksum::GenerateChecksumFromFileUnsafe(strCachedFilePath);

if (cachedChecksum != checksum)
return true;
if (cachedChecksum != checksum)
return true;

break;
}
default:
break;
break;
}
default:
break;
}
}

Expand Down

0 comments on commit 2846e27

Please sign in to comment.