aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Maps/Map.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/game/Maps/Map.cpp')
-rwxr-xr-xsrc/server/game/Maps/Map.cpp130
1 files changed, 65 insertions, 65 deletions
diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp
index b8c35d45e98..12011eab408 100755
--- a/src/server/game/Maps/Map.cpp
+++ b/src/server/game/Maps/Map.cpp
@@ -1022,24 +1022,24 @@ void Map::UnloadAll()
// *****************************
GridMap::GridMap()
{
- m_flags = 0;
+ _flags = 0;
// Area data
- m_gridArea = 0;
- m_area_map = NULL;
+ _gridArea = 0;
+ _areaMap = NULL;
// Height level data
- m_gridHeight = INVALID_HEIGHT;
- m_gridGetHeight = &GridMap::getHeightFromFlat;
+ _gridHeight = INVALID_HEIGHT;
+ _gridGetHeight = &GridMap::getHeightFromFlat;
m_V9 = NULL;
m_V8 = NULL;
// Liquid data
- m_liquidType = 0;
- m_liquid_offX = 0;
- m_liquid_offY = 0;
- m_liquid_width = 0;
- m_liquid_height = 0;
- m_liquidLevel = INVALID_HEIGHT;
- m_liquid_type = NULL;
- m_liquid_map = NULL;
+ _liquidType = 0;
+ _liquidOffX = 0;
+ _liquidOffY = 0;
+ _liquidWidth = 0;
+ _liquidHeight = 0;
+ _liquidLevel = INVALID_HEIGHT;
+ _liquidType = NULL;
+ _liquidMap = NULL;
}
GridMap::~GridMap()
@@ -1097,17 +1097,17 @@ bool GridMap::loadData(char *filename)
void GridMap::unloadData()
{
- delete[] m_area_map;
+ delete[] _areaMap;
delete[] m_V9;
delete[] m_V8;
- delete[] m_liquid_type;
- delete[] m_liquid_map;
- m_area_map = NULL;
+ delete[] _liquidType;
+ delete[] _liquidMap;
+ _areaMap = NULL;
m_V9 = NULL;
m_V8 = NULL;
- m_liquid_type = NULL;
- m_liquid_map = NULL;
- m_gridGetHeight = &GridMap::getHeightFromFlat;
+ _liquidType = NULL;
+ _liquidMap = NULL;
+ _gridGetHeight = &GridMap::getHeightFromFlat;
}
bool GridMap::loadAreaData(FILE* in, uint32 offset, uint32 /*size*/)
@@ -1118,11 +1118,11 @@ bool GridMap::loadAreaData(FILE* in, uint32 offset, uint32 /*size*/)
if (fread(&header, sizeof(header), 1, in) != 1 || header.fourcc != MapAreaMagic.asUInt)
return false;
- m_gridArea = header.gridArea;
+ _gridArea = header.gridArea;
if (!(header.flags & MAP_AREA_NO_AREA))
{
- m_area_map = new uint16 [16*16];
- if (fread(m_area_map, sizeof(uint16), 16*16, in) != 16*16)
+ _areaMap = new uint16 [16*16];
+ if (fread(_areaMap, sizeof(uint16), 16*16, in) != 16*16)
return false;
}
return true;
@@ -1136,7 +1136,7 @@ bool GridMap::loadHeihgtData(FILE* in, uint32 offset, uint32 /*size*/)
if (fread(&header, sizeof(header), 1, in) != 1 || header.fourcc != MapHeightMagic.asUInt)
return false;
- m_gridHeight = header.gridHeight;
+ _gridHeight = header.gridHeight;
if (!(header.flags & MAP_HEIGHT_NO_HEIGHT))
{
if ((header.flags & MAP_HEIGHT_AS_INT16))
@@ -1146,8 +1146,8 @@ bool GridMap::loadHeihgtData(FILE* in, uint32 offset, uint32 /*size*/)
if (fread(m_uint16_V9, sizeof(uint16), 129*129, in) != 129*129 ||
fread(m_uint16_V8, sizeof(uint16), 128*128, in) != 128*128)
return false;
- m_gridIntHeightMultiplier = (header.gridMaxHeight - header.gridHeight) / 65535;
- m_gridGetHeight = &GridMap::getHeightFromUint16;
+ _gridIntHeightMultiplier = (header.gridMaxHeight - header.gridHeight) / 65535;
+ _gridGetHeight = &GridMap::getHeightFromUint16;
}
else if ((header.flags & MAP_HEIGHT_AS_INT8))
{
@@ -1156,8 +1156,8 @@ bool GridMap::loadHeihgtData(FILE* in, uint32 offset, uint32 /*size*/)
if (fread(m_uint8_V9, sizeof(uint8), 129*129, in) != 129*129 ||
fread(m_uint8_V8, sizeof(uint8), 128*128, in) != 128*128)
return false;
- m_gridIntHeightMultiplier = (header.gridMaxHeight - header.gridHeight) / 255;
- m_gridGetHeight = &GridMap::getHeightFromUint8;
+ _gridIntHeightMultiplier = (header.gridMaxHeight - header.gridHeight) / 255;
+ _gridGetHeight = &GridMap::getHeightFromUint8;
}
else
{
@@ -1166,11 +1166,11 @@ bool GridMap::loadHeihgtData(FILE* in, uint32 offset, uint32 /*size*/)
if (fread(m_V9, sizeof(float), 129*129, in) != 129*129 ||
fread(m_V8, sizeof(float), 128*128, in) != 128*128)
return false;
- m_gridGetHeight = &GridMap::getHeightFromFloat;
+ _gridGetHeight = &GridMap::getHeightFromFloat;
}
}
else
- m_gridGetHeight = &GridMap::getHeightFromFlat;
+ _gridGetHeight = &GridMap::getHeightFromFlat;
return true;
}
@@ -1182,23 +1182,23 @@ bool GridMap::loadLiquidData(FILE* in, uint32 offset, uint32 /*size*/)
if (fread(&header, sizeof(header), 1, in) != 1 || header.fourcc != MapLiquidMagic.asUInt)
return false;
- m_liquidType = header.liquidType;
- m_liquid_offX = header.offsetX;
- m_liquid_offY = header.offsetY;
- m_liquid_width = header.width;
- m_liquid_height= header.height;
- m_liquidLevel = header.liquidLevel;
+ _liquidType = header.liquidType;
+ _liquidOffX = header.offsetX;
+ _liquidOffY = header.offsetY;
+ _liquidWidth = header.width;
+ _liquidHeight= header.height;
+ _liquidLevel = header.liquidLevel;
if (!(header.flags & MAP_LIQUID_NO_TYPE))
{
- m_liquid_type = new uint8 [16*16];
- if (fread(m_liquid_type, sizeof(uint8), 16*16, in) != 16*16)
+ _liquidType = new uint8 [16*16];
+ if (fread(_liquidType, sizeof(uint8), 16*16, in) != 16*16)
return false;
}
if (!(header.flags & MAP_LIQUID_NO_HEIGHT))
{
- m_liquid_map = new float [m_liquid_width*m_liquid_height];
- if (fread(m_liquid_map, sizeof(float), m_liquid_width*m_liquid_height, in) != m_liquid_width*m_liquid_height)
+ _liquidMap = new float [_liquidWidth*_liquidHeight];
+ if (fread(_liquidMap, sizeof(float), _liquidWidth*_liquidHeight, in) != _liquidWidth*_liquidHeight)
return false;
}
return true;
@@ -1206,25 +1206,25 @@ bool GridMap::loadLiquidData(FILE* in, uint32 offset, uint32 /*size*/)
uint16 GridMap::getArea(float x, float y)
{
- if (!m_area_map)
- return m_gridArea;
+ if (!_areaMap)
+ return _gridArea;
x = 16 * (32 - x/SIZE_OF_GRIDS);
y = 16 * (32 - y/SIZE_OF_GRIDS);
int lx = (int)x & 15;
int ly = (int)y & 15;
- return m_area_map[lx*16 + ly];
+ return _areaMap[lx*16 + ly];
}
float GridMap::getHeightFromFlat(float /*x*/, float /*y*/) const
{
- return m_gridHeight;
+ return _gridHeight;
}
float GridMap::getHeightFromFloat(float x, float y) const
{
if (!m_V8 || !m_V9)
- return m_gridHeight;
+ return _gridHeight;
x = MAP_RESOLUTION * (32 - x/SIZE_OF_GRIDS);
y = MAP_RESOLUTION * (32 - y/SIZE_OF_GRIDS);
@@ -1306,7 +1306,7 @@ float GridMap::getHeightFromFloat(float x, float y) const
float GridMap::getHeightFromUint8(float x, float y) const
{
if (!m_uint8_V8 || !m_uint8_V9)
- return m_gridHeight;
+ return _gridHeight;
x = MAP_RESOLUTION * (32 - x/SIZE_OF_GRIDS);
y = MAP_RESOLUTION * (32 - y/SIZE_OF_GRIDS);
@@ -1367,13 +1367,13 @@ float GridMap::getHeightFromUint8(float x, float y) const
}
}
// Calculate height
- return (float)((a * x) + (b * y) + c)*m_gridIntHeightMultiplier + m_gridHeight;
+ return (float)((a * x) + (b * y) + c)*_gridIntHeightMultiplier + _gridHeight;
}
float GridMap::getHeightFromUint16(float x, float y) const
{
if (!m_uint16_V8 || !m_uint16_V9)
- return m_gridHeight;
+ return _gridHeight;
x = MAP_RESOLUTION * (32 - x/SIZE_OF_GRIDS);
y = MAP_RESOLUTION * (32 - y/SIZE_OF_GRIDS);
@@ -1434,45 +1434,45 @@ float GridMap::getHeightFromUint16(float x, float y) const
}
}
// Calculate height
- return (float)((a * x) + (b * y) + c)*m_gridIntHeightMultiplier + m_gridHeight;
+ return (float)((a * x) + (b * y) + c)*_gridIntHeightMultiplier + _gridHeight;
}
float GridMap::getLiquidLevel(float x, float y)
{
- if (!m_liquid_map)
- return m_liquidLevel;
+ if (!_liquidMap)
+ return _liquidLevel;
x = MAP_RESOLUTION * (32 - x/SIZE_OF_GRIDS);
y = MAP_RESOLUTION * (32 - y/SIZE_OF_GRIDS);
- int cx_int = ((int)x & (MAP_RESOLUTION-1)) - m_liquid_offY;
- int cy_int = ((int)y & (MAP_RESOLUTION-1)) - m_liquid_offX;
+ int cx_int = ((int)x & (MAP_RESOLUTION-1)) - _liquidOffY;
+ int cy_int = ((int)y & (MAP_RESOLUTION-1)) - _liquidOffX;
- if (cx_int < 0 || cx_int >=m_liquid_height)
+ if (cx_int < 0 || cx_int >=_liquidHeight)
return INVALID_HEIGHT;
- if (cy_int < 0 || cy_int >=m_liquid_width)
+ if (cy_int < 0 || cy_int >=_liquidWidth)
return INVALID_HEIGHT;
- return m_liquid_map[cx_int*m_liquid_width + cy_int];
+ return _liquidMap[cx_int*_liquidWidth + cy_int];
}
uint8 GridMap::getTerrainType(float x, float y)
{
- if (!m_liquid_type)
+ if (!_liquidType)
return 0;
x = 16 * (32 - x/SIZE_OF_GRIDS);
y = 16 * (32 - y/SIZE_OF_GRIDS);
int lx = (int)x & 15;
int ly = (int)y & 15;
- return m_liquid_type[lx*16 + ly];
+ return _liquidType[lx*16 + ly];
}
// Get water state on map
inline ZLiquidStatus GridMap::getLiquidStatus(float x, float y, float z, uint8 ReqLiquidType, LiquidData* data)
{
// Check water type (if no water return)
- if (!m_liquid_type && !m_liquidType)
+ if (!_liquidType && !_liquidType)
return LIQUID_MAP_NO_WATER;
// Get cell
@@ -1483,7 +1483,7 @@ inline ZLiquidStatus GridMap::getLiquidStatus(float x, float y, float z, uint8 R
int y_int = (int)cy & (MAP_RESOLUTION-1);
// Check water type in cell
- uint8 type = m_liquid_type ? m_liquid_type[(x_int>>3)*16 + (y_int>>3)] : m_liquidType;
+ uint8 type = _liquidType ? _liquidType[(x_int>>3)*16 + (y_int>>3)] : _liquidType;
if (type == 0)
return LIQUID_MAP_NO_WATER;
@@ -1493,15 +1493,15 @@ inline ZLiquidStatus GridMap::getLiquidStatus(float x, float y, float z, uint8 R
// Check water level:
// Check water height map
- int lx_int = x_int - m_liquid_offY;
- int ly_int = y_int - m_liquid_offX;
- if (lx_int < 0 || lx_int >=m_liquid_height)
+ int lx_int = x_int - _liquidOffY;
+ int ly_int = y_int - _liquidOffX;
+ if (lx_int < 0 || lx_int >=_liquidHeight)
return LIQUID_MAP_NO_WATER;
- if (ly_int < 0 || ly_int >=m_liquid_width)
+ if (ly_int < 0 || ly_int >=_liquidWidth)
return LIQUID_MAP_NO_WATER;
// Get water level
- float liquid_level = m_liquid_map ? m_liquid_map[lx_int*m_liquid_width + ly_int] : m_liquidLevel;
+ float liquid_level = _liquidMap ? _liquidMap[lx_int*_liquidWidth + ly_int] : _liquidLevel;
// Get ground level (sub 0.2 for fix some errors)
float ground_level = getHeight(x, y);