Include build in to .map files data.

This let not update map fiels format version at switch to new build
for prevent use wrong .map files. Build checked at loading.
This commit is contained in:
VladimirMangos 2010-02-03 14:40:53 +03:00
parent baab45c0e6
commit 55bc9e8da7
5 changed files with 28 additions and 17 deletions

View file

@ -45,7 +45,7 @@
GridState* si_GridStates[MAX_GRID_STATE];
static char const* MAP_MAGIC = "MAPS";
static char const* MAP_VERSION_MAGIC = "w1.0";
static char const* MAP_VERSION_MAGIC = "v1.1";
static char const* MAP_AREA_MAGIC = "AREA";
static char const* MAP_HEIGHT_MAGIC = "MHGT";
static char const* MAP_LIQUID_MAGIC = "MLIQ";
@ -85,7 +85,8 @@ bool Map::ExistMap(uint32 mapid,int gx,int gy)
map_fileheader header;
fread(&header, sizeof(header), 1, pf);
if (header.mapMagic != *((uint32 const*)(MAP_MAGIC)) ||
header.versionMagic != *((uint32 const*)(MAP_VERSION_MAGIC)))
header.versionMagic != *((uint32 const*)(MAP_VERSION_MAGIC)) ||
!IsAcceptableClientBuild(header.buildMagic))
{
sLog.outError("Map file '%s' is non-compatible version (outdated?). Please, create new using ad.exe program.",tmp);
delete [] tmp;
@ -1193,7 +1194,8 @@ bool GridMap::loadData(char *filename)
return true;
fread(&header, sizeof(header),1,in);
if (header.mapMagic == *((uint32 const*)(MAP_MAGIC)) &&
header.versionMagic == *((uint32 const*)(MAP_VERSION_MAGIC)))
header.versionMagic == *((uint32 const*)(MAP_VERSION_MAGIC)) ||
!IsAcceptableClientBuild(header.buildMagic))
{
// loadup area data
if (header.areaMapOffset && !loadAreaData(in, header.areaMapOffset, header.areaMapSize))