Merge pull request #7348 from Robyt3/Tools-Map-Version-Check

Fix map version checks in map_diff and map_extract tools
This commit is contained in:
heinrich5991 2023-10-14 16:16:11 +00:00 committed by GitHub
commit 788a2ad1ff
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 6 deletions

View file

@ -17,10 +17,12 @@ bool Process(IStorage *pStorage, const char **pMapNames)
return false;
}
// check version
CMapItemVersion *pVersion = (CMapItemVersion *)aMaps[i].FindItem(MAPITEMTYPE_VERSION, 0);
if(pVersion && pVersion->m_Version != 1)
const CMapItemVersion *pVersion = static_cast<CMapItemVersion *>(aMaps[i].FindItem(MAPITEMTYPE_VERSION, 0));
if(pVersion == nullptr || pVersion->m_Version != CMapItemVersion::CURRENT_VERSION)
{
dbg_msg("map_compare", "unsupported map version '%s'", pMapNames[i]);
return false;
}
}
int aStart[2], aNum[2];

View file

@ -16,10 +16,12 @@ bool Process(IStorage *pStorage, const char *pMapName, const char *pPathSave)
return false;
}
// check version
CMapItemVersion *pVersion = (CMapItemVersion *)Reader.FindItem(MAPITEMTYPE_VERSION, 0);
if(pVersion && pVersion->m_Version != 1)
const CMapItemVersion *pVersion = static_cast<CMapItemVersion *>(Reader.FindItem(MAPITEMTYPE_VERSION, 0));
if(pVersion == nullptr || pVersion->m_Version != CMapItemVersion::CURRENT_VERSION)
{
dbg_msg("map_extract", "unsupported map version '%s'", pMapName);
return false;
}
dbg_msg("map_extract", "Make sure you have the permission to use these images and sounds in your own maps");