Core/Maps: restored some older codes until the corresponding commits has been merged and (fixed?) a crash regarding terrain swap map area id's

This commit is contained in:
Ovahlord committed 2018-07-22 00:49:23 +02:00
1 parent 59d169e8e4
commit 4692c0ff6f
7 files changed
+44 -27

No files matched your search

+2 -12
View File
@@ -2353,8 +2353,9 @@ GridMap* Map::GetGrid(uint32 mapId, float x, float y)
EnsureGridCreated(GridCoord((MAX_NUMBER_OF_GRIDS - 1) - gx, (MAX_NUMBER_OF_GRIDS - 1) - gy));
GridMap* grid = GridMaps[gx][gy];
auto childMapItr = std::find_if(m_childTerrainMaps->begin(), m_childTerrainMaps->end(), [mapId](Map* childTerrainMap) { return childTerrainMap->GetId() == mapId; });
if (childMapItr != m_childTerrainMaps->end() && (*childMapItr)->GridMaps[gx][gy]->fileExists())
if (childMapItr != m_childTerrainMaps->end() && (*childMapItr)->GridMaps[gx][gy] && (*childMapItr)->GridMaps[gx][gy]->fileExists())
grid = (*childMapItr)->GridMaps[gx][gy];
return grid;
@@ -2511,7 +2512,6 @@ uint32 Map::GetAreaId(PhaseShift const& phaseShift, float x, float y, float z, b
}
}
if (!areaId)
{
if (GridMap* gmap = m_parentTerrainMap->GetGrid(PhasingHandler::GetTerrainMapId(phaseShift, this, x, y), x, y))
@@ -2532,11 +2532,6 @@ uint32 Map::GetAreaId(PhaseShift const& phaseShift, float x, float y, float z, b
return areaId;
}
uint32 Map::GetAreaId(PhaseShift const& phaseShift, float x, float y, float z) const
{
return GetAreaId(phaseShift, x, y, z, nullptr);
}
uint32 Map::GetZoneId(PhaseShift const& phaseShift, float x, float y, float z) const
{
uint32 areaId = GetAreaId(phaseShift, x, y, z);
@@ -2682,11 +2677,6 @@ bool Map::getObjectHitPos(PhaseShift const& phaseShift, float x1, float y1, floa
return result;
}
float Map::GetHeight(PhaseShift const& phaseShift, float x, float y, float z, bool vmap /*= true*/, float maxSearchDist /*= DEFAULT_HEIGHT_SEARCH*/) const
{
return std::max<float>(GetStaticHeight(phaseShift, x, y, z, vmap, maxSearchDist), _dynamicTree.getHeight(x, y, z, maxSearchDist, phaseShift));
}
bool Map::IsInWater(PhaseShift const& phaseShift, float x, float y, float pZ, LiquidData* data) const
{
LiquidData liquid_status;