Core/Maps: Improvements to terrain swap handling

* Fixed memory leak when unloading grids
* Handle child maps being entered
* Allow chaining more child maps (Draenor -> Tanaan Jungle -> Tanaan Jungle - No Hubs Phase)
This commit is contained in:
Shauren
2020-05-24 22:34:25 +02:00
parent ebb6f12db8
commit eba31dea27
12 changed files with 187 additions and 152 deletions

View File

@@ -248,7 +248,7 @@ public:
else
player->SaveRecallPosition();
Map const* map = sMapMgr->CreateBaseMap(mapId);
Map* map = sMapMgr->CreateBaseMap(mapId);
float z = std::max(map->GetStaticHeight(PhasingHandler::GetEmptyPhaseShift(), x, y, MAX_HEIGHT), map->GetWaterLevel(PhasingHandler::GetEmptyPhaseShift(), x, y));
player->TeleportTo(mapId, x, y, z, player->GetOrientation());
@@ -370,7 +370,7 @@ public:
else
player->SaveRecallPosition();
Map const* map = sMapMgr->CreateBaseMap(mapId);
Map* map = sMapMgr->CreateBaseMap(mapId);
z = std::max(map->GetStaticHeight(PhasingHandler::GetEmptyPhaseShift(), x, y, MAX_HEIGHT), map->GetWaterLevel(PhasingHandler::GetEmptyPhaseShift(), x, y));
player->TeleportTo(mapId, x, y, z, 0.0f);
@@ -506,7 +506,7 @@ public:
AreaTableEntry const* zoneEntry = areaEntry->ParentAreaID ? sAreaTableStore.LookupEntry(areaEntry->ParentAreaID) : areaEntry;
ASSERT(zoneEntry);
Map const* map = sMapMgr->CreateBaseMap(zoneEntry->ContinentID);
Map* map = sMapMgr->CreateBaseMap(zoneEntry->ContinentID);
if (map->Instanceable())
{
@@ -581,7 +581,7 @@ public:
handler->SetSentErrorMessage(true);
return false;
}
Map const* map = sMapMgr->CreateBaseMap(mapId);
Map* map = sMapMgr->CreateBaseMap(mapId);
z = std::max(map->GetStaticHeight(PhasingHandler::GetEmptyPhaseShift(), x, y, MAX_HEIGHT), map->GetWaterLevel(PhasingHandler::GetEmptyPhaseShift(), x, y));
}

View File

@@ -260,7 +260,7 @@ public:
sDB2Manager.Map2ZoneCoordinates(zoneId, zoneX, zoneY);
Map const* map = object->GetMap();
Map* map = object->GetMap();
float groundZ = map->GetHeight(object->GetPhaseShift(), object->GetPositionX(), object->GetPositionY(), MAX_HEIGHT);
float floorZ = map->GetHeight(object->GetPhaseShift(), object->GetPositionX(), object->GetPositionY(), object->GetPositionZ());