[9103] Make gcc happy with muti-byte char casts and use more readable magic strings.

This commit is contained in:
VladimirMangos 2010-01-02 20:26:32 +03:00
parent 7496a6b91b
commit aa372cbfda
3 changed files with 14 additions and 14 deletions

View file

@ -46,6 +46,12 @@
GridState* si_GridStates[MAX_GRID_STATE];
static char const* MAP_MAGIC = "MAPS";
static char const* MAP_VERSION_MAGIC = "w1.0";
static char const* MAP_AREA_MAGIC = "AREA";
static char const* MAP_HEIGHT_MAGIC = "MHGT";
static char const* MAP_LIQUID_MAGIC = "MLIQ";
struct ScriptAction
{
uint64 sourceGUID;
@ -80,8 +86,8 @@ bool Map::ExistMap(uint32 mapid,int gx,int gy)
map_fileheader header;
fread(&header, sizeof(header), 1, pf);
if (header.mapMagic != uint32(MAP_MAGIC) ||
header.versionMagic != uint32(MAP_VERSION_MAGIC))
if (header.mapMagic != *((uint32 const*)(MAP_MAGIC)) ||
header.versionMagic != *((uint32 const*)(MAP_VERSION_MAGIC)))
{
sLog.outError("Map file '%s' is non-compatible version (outdated?). Please, create new using ad.exe program.",tmp);
delete [] tmp;
@ -1195,8 +1201,8 @@ bool GridMap::loadData(char *filename)
if (!in)
return true;
fread(&header, sizeof(header),1,in);
if (header.mapMagic == uint32(MAP_MAGIC) &&
header.versionMagic == uint32(MAP_VERSION_MAGIC))
if (header.mapMagic == *((uint32 const*)(MAP_MAGIC)) &&
header.versionMagic == *((uint32 const*)(MAP_VERSION_MAGIC)))
{
// loadup area data
if (header.areaMapOffset && !loadAreaData(in, header.areaMapOffset, header.areaMapSize))
@ -1247,7 +1253,7 @@ bool GridMap::loadAreaData(FILE *in, uint32 offset, uint32 size)
map_areaHeader header;
fseek(in, offset, SEEK_SET);
fread(&header, sizeof(header), 1, in);
if (header.fourcc != uint32(MAP_AREA_MAGIC))
if (header.fourcc != *((uint32 const*)(MAP_AREA_MAGIC)))
return false;
m_gridArea = header.gridArea;
@ -1264,7 +1270,7 @@ bool GridMap::loadHeihgtData(FILE *in, uint32 offset, uint32 size)
map_heightHeader header;
fseek(in, offset, SEEK_SET);
fread(&header, sizeof(header), 1, in);
if (header.fourcc != uint32(MAP_HEIGHT_MAGIC))
if (header.fourcc != *((uint32 const*)(MAP_HEIGHT_MAGIC)))
return false;
m_gridHeight = header.gridHeight;
@ -1307,7 +1313,7 @@ bool GridMap::loadLiquidData(FILE *in, uint32 offset, uint32 size)
map_liquidHeader header;
fseek(in, offset, SEEK_SET);
fread(&header, sizeof(header), 1, in);
if (header.fourcc != uint32(MAP_LIQUID_MAGIC))
if (header.fourcc != *((uint32 const*)(MAP_LIQUID_MAGIC)))
return false;
m_liquidType = header.liquidType;

View file

@ -71,12 +71,6 @@ typedef MaNGOS::SingleThreaded<GridRWLock>::Lock NullGuard;
//******************************************
// Map file format defines
//******************************************
#define MAP_MAGIC 'SPAM'
#define MAP_VERSION_MAGIC '0.1w'
#define MAP_AREA_MAGIC 'AERA'
#define MAP_HEIGHT_MAGIC 'TGHM'
#define MAP_LIQUID_MAGIC 'QILM'
struct map_fileheader
{
uint32 mapMagic;

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "9102"
#define REVISION_NR "9103"
#endif // __REVISION_NR_H__