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 authored and Ovahlord committed 2020-06-11 01:35:27 +02:00
1 parent 8adca7637b
commit 40f80fc0ed
13 files changed
+185 -159

No files matched your search

+3 -3
View File
@@ -242,7 +242,7 @@ public:
else
player->SaveRecallPosition();
Map const* map = sMapMgr->CreateBaseMap(mapId);
Map* map = sMapMgr->CreateBaseMap(mapId);
float z = std::max(map->GetHeight(PhasingHandler::GetEmptyPhaseShift(), x, y, MAX_HEIGHT), map->GetWaterLevel(PhasingHandler::GetEmptyPhaseShift(), x, y));
player->TeleportTo(mapId, x, y, z, player->GetOrientation());
@@ -314,7 +314,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())
{
@@ -371,7 +371,7 @@ public:
handler->SetSentErrorMessage(true);
return false;
}
Map const* map = sMapMgr->CreateBaseMap(mapId);
Map* map = sMapMgr->CreateBaseMap(mapId);
z = std::max(map->GetHeight(PhasingHandler::GetEmptyPhaseShift(), x, y, MAX_HEIGHT), map->GetWaterLevel(PhasingHandler::GetEmptyPhaseShift(), x, y));
}
+1 -1
View File
@@ -688,7 +688,7 @@ public:
static bool HandleListRespawnsCommand(ChatHandler* handler, char const* args)
{
Player const* player = handler->GetSession()->GetPlayer();
Map const* map = player->GetMap();
Map* map = player->GetMap();
uint32 range = 0;
if (*args)
+1 -1
View File
@@ -252,7 +252,7 @@ public:
sDBCManager.Map2ZoneCoordinates(zoneX, zoneY, zoneId);
Map const* map = object->GetMap();
Map* map = object->GetMap();
float groundZ = object->GetMapHeight(object->GetPositionX(), object->GetPositionY(), MAX_HEIGHT);
float floorZ = object->GetMapHeight(object->GetPositionX(), object->GetPositionY(), object->GetPositionZ());
@@ -327,7 +327,7 @@ class boss_foe_reaper_5000 : public CreatureScript
// and use our own position instead of our home position
float respX, respY, respZ, respO, destX, destY, destZ, travelDistZ;
me->GetPosition(respX, respY, respZ, respO);
Map const* map = me->GetMap();
Map* map = me->GetMap();
const float angle = float(rand_norm()) * static_cast<float>(M_PI * 2.0f);
const float range = 15.0f;
const float distanceX = range * std::cos(angle);