From 42877e75e2a67514dfeb185661e4f397b6eb044a Mon Sep 17 00:00:00 2001 From: Giacomo Pozzoni Date: Sun, 4 Apr 2021 21:49:50 +0200 Subject: Core/Maps: Change .map file version from FourCC to uint32 (#26326) --- src/server/game/Maps/Map.cpp | 14 +++++++------- src/server/game/Maps/Map.h | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'src/server') diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp index e3289f08642..1f15e1f793c 100644 --- a/src/server/game/Maps/Map.cpp +++ b/src/server/game/Maps/Map.cpp @@ -55,7 +55,7 @@ BOOST_1_74_FIBONACCI_HEAP_MSVC_COMPILE_FIX(RespawnListContainer::value_type) u_map_magic MapMagic = { {'M','A','P','S'} }; -u_map_magic MapVersionMagic = { {'v','1','.','9'} }; +uint32 MapVersionMagic = 9; u_map_magic MapAreaMagic = { {'A','R','E','A'} }; u_map_magic MapHeightMagic = { {'M','H','G','T'} }; u_map_magic MapLiquidMagic = { {'M','L','I','Q'} }; @@ -116,9 +116,9 @@ bool Map::ExistMap(uint32 mapid, int gx, int gy) map_fileheader header; if (fread(&header, sizeof(header), 1, pf) == 1) { - if (header.mapMagic.asUInt != MapMagic.asUInt || header.versionMagic.asUInt != MapVersionMagic.asUInt) - TC_LOG_ERROR("maps", "Map file '%s' is from an incompatible map version (%.*s %.*s), %.*s %.*s is expected. Please pull your source, recompile tools and recreate maps using the updated mapextractor, then replace your old map files with new files. If you still have problems search on forum for error TCE00018.", - fileName, 4, header.mapMagic.asChar, 4, header.versionMagic.asChar, 4, MapMagic.asChar, 4, MapVersionMagic.asChar); + if (header.mapMagic.asUInt != MapMagic.asUInt || header.versionMagic != MapVersionMagic) + TC_LOG_ERROR("maps", "Map file '%s' is from an incompatible map version (%.*s v%u), %.*s v%u is expected. Please pull your source, recompile tools and recreate maps using the updated mapextractor, then replace your old map files with new files. If you still have problems search on forum for error TCE00018.", + fileName, 4, header.mapMagic.asChar, header.versionMagic, 4, MapMagic.asChar, MapVersionMagic); else ret = true; } @@ -1827,7 +1827,7 @@ bool GridMap::loadData(char const* filename) return false; } - if (header.mapMagic.asUInt == MapMagic.asUInt && header.versionMagic.asUInt == MapVersionMagic.asUInt) + if (header.mapMagic.asUInt == MapMagic.asUInt && header.versionMagic == MapVersionMagic) { // load up area data if (header.areaMapOffset && !loadAreaData(in, header.areaMapOffset, header.areaMapSize)) @@ -1861,8 +1861,8 @@ bool GridMap::loadData(char const* filename) return true; } - TC_LOG_ERROR("maps", "Map file '%s' is from an incompatible map version (%.*s %.*s), %.*s %.*s is expected. Please pull your source, recompile tools and recreate maps using the updated mapextractor, then replace your old map files with new files. If you still have problems search on forum for error TCE00018.", - filename, 4, header.mapMagic.asChar, 4, header.versionMagic.asChar, 4, MapMagic.asChar, 4, MapVersionMagic.asChar); + TC_LOG_ERROR("maps", "Map file '%s' is from an incompatible map version (%.*s v%u), %.*s v%u is expected. Please pull your source, recompile tools and recreate maps using the updated mapextractor, then replace your old map files with new files. If you still have problems search on forum for error TCE00018.", + filename, 4, header.mapMagic.asChar, header.versionMagic, 4, MapMagic.asChar, MapVersionMagic); fclose(in); return false; } diff --git a/src/server/game/Maps/Map.h b/src/server/game/Maps/Map.h index c1bc2ff6455..f563c6205bb 100644 --- a/src/server/game/Maps/Map.h +++ b/src/server/game/Maps/Map.h @@ -89,7 +89,7 @@ union u_map_magic struct map_fileheader { u_map_magic mapMagic; - u_map_magic versionMagic; + uint32 versionMagic; u_map_magic buildMagic; uint32 areaMapOffset; uint32 areaMapSize; -- cgit v1.2.3