Fix some warnings here and there

This commit is contained in:
Spp-
2011-07-27 11:00:39 +02:00
parent 39be30a39f
commit fa50c0a464
8 changed files with 50 additions and 48 deletions

View File

@@ -31,6 +31,19 @@
#include "ObjectMgr.h"
#include "Group.h"
union u_map_magic
{
char asChar[4];
uint32 asUInt;
};
u_map_magic MapMagic = { {'M','A','P','S'} };
u_map_magic MapVersionMagic = { {'v','1','.','1'} };
u_map_magic MapAreaMagic = { {'A','R','E','A'} };
u_map_magic MapHeightMagic = { {'M','H','G','T'} };
u_map_magic MapLiquidMagic = { {'M','L','I','Q'} };
#define DEFAULT_GRID_EXPIRY 300
#define MAX_GRID_LOAD_TIME 50
#define MAX_CREATURE_ATTACK_RADIUS (45.0f * sWorld->getRate(RATE_CREATURE_AGGRO))
@@ -72,12 +85,12 @@ bool Map::ExistMap(uint32 mapid, int gx, int gy)
map_fileheader header;
if (fread(&header, sizeof(header), 1, pf) == 1)
{
if (header.mapMagic != uint32(MAP_MAGIC) || header.versionMagic != uint32(MAP_VERSION_MAGIC))
if (header.mapMagic != MapMagic.asUInt || header.versionMagic != MapVersionMagic.asUInt)
sLog->outError("Map file '%s' is from an incompatible clientversion. Please recreate using the mapextractor.", tmp);
else
ret = true;
}
fclose(pf);
fclose(pf);
}
delete [] tmp;
return ret;
@@ -799,15 +812,10 @@ void Map::MoveAllCreaturesInMoveList()
// get data and remove element;
CreatureMoveList::iterator iter = i_creaturesToMove.begin();
Creature* c = iter->first;
CreatureMover cm = iter->second;
i_creaturesToMove.erase(iter);
// calculate cells
CellPair new_val = Trinity::ComputeCellPair(cm.x, cm.y);
Cell new_cell(new_val);
const CreatureMover &cm = iter->second;
// do move or do move to respawn or remove creature if previous all fail
if (CreatureCellRelocation(c, new_cell))
if (CreatureCellRelocation(c, Cell(Trinity::ComputeCellPair(cm.x, cm.y))))
{
// update pos
c->Relocate(cm.x, cm.y, cm.z, cm.ang);
@@ -827,6 +835,8 @@ void Map::MoveAllCreaturesInMoveList()
AddObjectToRemoveList(c);
}
}
i_creaturesToMove.erase(iter);
}
}
@@ -1059,7 +1069,7 @@ bool GridMap::loadData(char *filename)
return false;
}
if (header.mapMagic == uint32(MAP_MAGIC) && header.versionMagic == uint32(MAP_VERSION_MAGIC))
if (header.mapMagic == MapMagic.asUInt && header.versionMagic == MapVersionMagic.asUInt)
{
// loadup area data
if (header.areaMapOffset && !loadAreaData(in, header.areaMapOffset, header.areaMapSize))
@@ -1110,7 +1120,7 @@ bool GridMap::loadAreaData(FILE *in, uint32 offset, uint32 /*size*/)
map_areaHeader header;
fseek(in, offset, SEEK_SET);
if (fread(&header, sizeof(header), 1, in) != 1 || header.fourcc != uint32(MAP_AREA_MAGIC))
if (fread(&header, sizeof(header), 1, in) != 1 || header.fourcc != MapAreaMagic.asUInt)
return false;
m_gridArea = header.gridArea;
@@ -1128,7 +1138,7 @@ bool GridMap::loadHeihgtData(FILE *in, uint32 offset, uint32 /*size*/)
map_heightHeader header;
fseek(in, offset, SEEK_SET);
if (fread(&header, sizeof(header), 1, in) != 1 || header.fourcc != uint32(MAP_HEIGHT_MAGIC))
if (fread(&header, sizeof(header), 1, in) != 1 || header.fourcc != MapHeightMagic.asUInt)
return false;
m_gridHeight = header.gridHeight;
@@ -1174,7 +1184,7 @@ bool GridMap::loadLiquidData(FILE *in, uint32 offset, uint32 /*size*/)
map_liquidHeader header;
fseek(in, offset, SEEK_SET);
if (fread(&header, sizeof(header), 1, in) != 1 || header.fourcc != uint32(MAP_LIQUID_MAGIC))
if (fread(&header, sizeof(header), 1, in) != 1 || header.fourcc != MapLiquidMagic.asUInt)
return false;
m_liquidType = header.liquidType;