mirror of
https://github.com/mangosfour/server.git
synced 2025-12-12 10:37:03 +00:00
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:
parent
baab45c0e6
commit
55bc9e8da7
5 changed files with 28 additions and 17 deletions
|
|
@ -275,16 +275,17 @@ void ReadLiquidTypeTableDBC()
|
||||||
//
|
//
|
||||||
|
|
||||||
// Map file format data
|
// Map file format data
|
||||||
#define MAP_MAGIC 'SPAM'
|
static char const* MAP_MAGIC = "MAPS";
|
||||||
#define MAP_VERSION_MAGIC '0.1w'
|
static char const* MAP_VERSION_MAGIC = "v1.1";
|
||||||
#define MAP_AREA_MAGIC 'AERA'
|
static char const* MAP_AREA_MAGIC = "AREA";
|
||||||
#define MAP_HEIGHT_MAGIC 'TGHM'
|
static char const* MAP_HEIGHT_MAGIC = "MHGT";
|
||||||
#define MAP_LIQUID_MAGIC 'QILM'
|
static char const* MAP_LIQUID_MAGIC = "MLIQ";
|
||||||
|
|
||||||
struct map_fileheader
|
struct map_fileheader
|
||||||
{
|
{
|
||||||
uint32 mapMagic;
|
uint32 mapMagic;
|
||||||
uint32 versionMagic;
|
uint32 versionMagic;
|
||||||
|
uint32 buildMagic;
|
||||||
uint32 areaMapOffset;
|
uint32 areaMapOffset;
|
||||||
uint32 areaMapSize;
|
uint32 areaMapSize;
|
||||||
uint32 heightMapOffset;
|
uint32 heightMapOffset;
|
||||||
|
|
@ -362,7 +363,7 @@ uint8 liquid_type[ADT_CELLS_PER_GRID][ADT_CELLS_PER_GRID];
|
||||||
bool liquid_show[ADT_GRID_SIZE][ADT_GRID_SIZE];
|
bool liquid_show[ADT_GRID_SIZE][ADT_GRID_SIZE];
|
||||||
float liquid_height[ADT_GRID_SIZE+1][ADT_GRID_SIZE+1];
|
float liquid_height[ADT_GRID_SIZE+1][ADT_GRID_SIZE+1];
|
||||||
|
|
||||||
bool ConvertADT(char *filename, char *filename2, int cell_y, int cell_x)
|
bool ConvertADT(char *filename, char *filename2, int cell_y, int cell_x, uint32 build)
|
||||||
{
|
{
|
||||||
ADT_file adt;
|
ADT_file adt;
|
||||||
|
|
||||||
|
|
@ -381,8 +382,9 @@ bool ConvertADT(char *filename, char *filename2, int cell_y, int cell_x)
|
||||||
|
|
||||||
// Prepare map header
|
// Prepare map header
|
||||||
map_fileheader map;
|
map_fileheader map;
|
||||||
map.mapMagic = MAP_MAGIC;
|
map.mapMagic = *(uint32 const*)MAP_MAGIC;
|
||||||
map.versionMagic = MAP_VERSION_MAGIC;
|
map.versionMagic = *(uint32 const*)MAP_VERSION_MAGIC;
|
||||||
|
map.buildMagic = build;
|
||||||
|
|
||||||
// Get area flags data
|
// Get area flags data
|
||||||
for (int i=0;i<ADT_CELLS_PER_GRID;i++)
|
for (int i=0;i<ADT_CELLS_PER_GRID;i++)
|
||||||
|
|
@ -424,7 +426,7 @@ bool ConvertADT(char *filename, char *filename2, int cell_y, int cell_x)
|
||||||
map.areaMapSize = sizeof(map_areaHeader);
|
map.areaMapSize = sizeof(map_areaHeader);
|
||||||
|
|
||||||
map_areaHeader areaHeader;
|
map_areaHeader areaHeader;
|
||||||
areaHeader.fourcc = MAP_AREA_MAGIC;
|
areaHeader.fourcc = *(uint32 const*)MAP_AREA_MAGIC;
|
||||||
areaHeader.flags = 0;
|
areaHeader.flags = 0;
|
||||||
if (fullAreaData)
|
if (fullAreaData)
|
||||||
{
|
{
|
||||||
|
|
@ -553,7 +555,7 @@ bool ConvertADT(char *filename, char *filename2, int cell_y, int cell_x)
|
||||||
map.heightMapSize = sizeof(map_heightHeader);
|
map.heightMapSize = sizeof(map_heightHeader);
|
||||||
|
|
||||||
map_heightHeader heightHeader;
|
map_heightHeader heightHeader;
|
||||||
heightHeader.fourcc = MAP_HEIGHT_MAGIC;
|
heightHeader.fourcc = *(uint32 const*)MAP_HEIGHT_MAGIC;
|
||||||
heightHeader.flags = 0;
|
heightHeader.flags = 0;
|
||||||
heightHeader.gridHeight = minHeight;
|
heightHeader.gridHeight = minHeight;
|
||||||
heightHeader.gridMaxHeight = maxHeight;
|
heightHeader.gridMaxHeight = maxHeight;
|
||||||
|
|
@ -788,7 +790,7 @@ bool ConvertADT(char *filename, char *filename2, int cell_y, int cell_x)
|
||||||
}
|
}
|
||||||
map.liquidMapOffset = map.heightMapOffset + map.heightMapSize;
|
map.liquidMapOffset = map.heightMapOffset + map.heightMapSize;
|
||||||
map.liquidMapSize = sizeof(map_liquidHeader);
|
map.liquidMapSize = sizeof(map_liquidHeader);
|
||||||
liquidHeader.fourcc = MAP_LIQUID_MAGIC;
|
liquidHeader.fourcc = *(uint32 const*)MAP_LIQUID_MAGIC;
|
||||||
liquidHeader.flags = 0;
|
liquidHeader.flags = 0;
|
||||||
liquidHeader.liquidType = 0;
|
liquidHeader.liquidType = 0;
|
||||||
liquidHeader.offsetX = minX;
|
liquidHeader.offsetX = minX;
|
||||||
|
|
@ -867,7 +869,7 @@ bool ConvertADT(char *filename, char *filename2, int cell_y, int cell_x)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ExtractMapsFromMpq()
|
void ExtractMapsFromMpq(uint32 build)
|
||||||
{
|
{
|
||||||
char mpq_filename[1024];
|
char mpq_filename[1024];
|
||||||
char output_filename[1024];
|
char output_filename[1024];
|
||||||
|
|
@ -905,7 +907,7 @@ void ExtractMapsFromMpq()
|
||||||
continue;
|
continue;
|
||||||
sprintf(mpq_filename, "World\\Maps\\%s\\%s_%u_%u.adt", map_ids[z].name, map_ids[z].name, x, y);
|
sprintf(mpq_filename, "World\\Maps\\%s\\%s_%u_%u.adt", map_ids[z].name, map_ids[z].name, x, y);
|
||||||
sprintf(output_filename, "%s/maps/%03u%02u%02u.map", output_path, map_ids[z].id, y, x);
|
sprintf(output_filename, "%s/maps/%03u%02u%02u.map", output_path, map_ids[z].id, y, x);
|
||||||
ConvertADT(mpq_filename, output_filename, y, x);
|
ConvertADT(mpq_filename, output_filename, y, x, build);
|
||||||
}
|
}
|
||||||
// draw progress bar
|
// draw progress bar
|
||||||
printf("Processing........................%d%%\r", (100 * (y+1)) / WDT_MAP_SIZE);
|
printf("Processing........................%d%%\r", (100 * (y+1)) / WDT_MAP_SIZE);
|
||||||
|
|
@ -1075,7 +1077,7 @@ int main(int argc, char * arg[])
|
||||||
LoadCommonMPQFiles();
|
LoadCommonMPQFiles();
|
||||||
|
|
||||||
// Extract maps
|
// Extract maps
|
||||||
ExtractMapsFromMpq();
|
ExtractMapsFromMpq(build);
|
||||||
|
|
||||||
// Close MPQs
|
// Close MPQs
|
||||||
CloseMPQFiles();
|
CloseMPQFiles();
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -45,7 +45,7 @@
|
||||||
GridState* si_GridStates[MAX_GRID_STATE];
|
GridState* si_GridStates[MAX_GRID_STATE];
|
||||||
|
|
||||||
static char const* MAP_MAGIC = "MAPS";
|
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_AREA_MAGIC = "AREA";
|
||||||
static char const* MAP_HEIGHT_MAGIC = "MHGT";
|
static char const* MAP_HEIGHT_MAGIC = "MHGT";
|
||||||
static char const* MAP_LIQUID_MAGIC = "MLIQ";
|
static char const* MAP_LIQUID_MAGIC = "MLIQ";
|
||||||
|
|
@ -85,7 +85,8 @@ bool Map::ExistMap(uint32 mapid,int gx,int gy)
|
||||||
map_fileheader header;
|
map_fileheader header;
|
||||||
fread(&header, sizeof(header), 1, pf);
|
fread(&header, sizeof(header), 1, pf);
|
||||||
if (header.mapMagic != *((uint32 const*)(MAP_MAGIC)) ||
|
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);
|
sLog.outError("Map file '%s' is non-compatible version (outdated?). Please, create new using ad.exe program.",tmp);
|
||||||
delete [] tmp;
|
delete [] tmp;
|
||||||
|
|
@ -1193,7 +1194,8 @@ bool GridMap::loadData(char *filename)
|
||||||
return true;
|
return true;
|
||||||
fread(&header, sizeof(header),1,in);
|
fread(&header, sizeof(header),1,in);
|
||||||
if (header.mapMagic == *((uint32 const*)(MAP_MAGIC)) &&
|
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
|
// loadup area data
|
||||||
if (header.areaMapOffset && !loadAreaData(in, header.areaMapOffset, header.areaMapSize))
|
if (header.areaMapOffset && !loadAreaData(in, header.areaMapOffset, header.areaMapSize))
|
||||||
|
|
|
||||||
|
|
@ -54,6 +54,7 @@ struct map_fileheader
|
||||||
{
|
{
|
||||||
uint32 mapMagic;
|
uint32 mapMagic;
|
||||||
uint32 versionMagic;
|
uint32 versionMagic;
|
||||||
|
uint32 buildMagic;
|
||||||
uint32 areaMapOffset;
|
uint32 areaMapOffset;
|
||||||
uint32 areaMapSize;
|
uint32 areaMapSize;
|
||||||
uint32 heightMapOffset;
|
uint32 heightMapOffset;
|
||||||
|
|
|
||||||
|
|
@ -6140,6 +6140,12 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
// Glyph of Mend Pet
|
||||||
|
if(dummySpell->Id == 57870)
|
||||||
|
{
|
||||||
|
pVictim->CastSpell(pVictim, 57894, true, NULL, NULL, GetGUID());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SPELLFAMILY_PALADIN:
|
case SPELLFAMILY_PALADIN:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue