diff --git a/src/tools/map_diff.cpp b/src/tools/map_diff.cpp index 3aca5383c..34155649e 100644 --- a/src/tools/map_diff.cpp +++ b/src/tools/map_diff.cpp @@ -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(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]; diff --git a/src/tools/map_extract.cpp b/src/tools/map_extract.cpp index 2f71c8a56..d66bbf25e 100644 --- a/src/tools/map_extract.cpp +++ b/src/tools/map_extract.cpp @@ -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(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");