mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-18 16:38:42 +01:00
Core/Maps: removed GetBaseMap in order to fix a gridmap crash
This commit is contained in:
@@ -2023,12 +2023,6 @@ void WorldObject::ResetMap()
|
||||
//m_InstanceId = 0;
|
||||
}
|
||||
|
||||
Map const* WorldObject::GetBaseMap() const
|
||||
{
|
||||
ASSERT(m_currMap);
|
||||
return m_currMap->GetParent();
|
||||
}
|
||||
|
||||
void WorldObject::AddObjectToRemoveList()
|
||||
{
|
||||
ASSERT(m_uint32Values);
|
||||
|
||||
@@ -392,9 +392,6 @@ class TC_GAME_API WorldObject : public Object, public WorldLocation
|
||||
Map* FindMap() const { return m_currMap; }
|
||||
//used to check all object's GetMap() calls when object is not in world!
|
||||
|
||||
//this function should be removed in nearest time...
|
||||
Map const* GetBaseMap() const;
|
||||
|
||||
void SetZoneScript();
|
||||
void ClearZoneScript();
|
||||
ZoneScript* GetZoneScript() const { return m_zoneScript; }
|
||||
|
||||
@@ -1321,7 +1321,7 @@ void Player::Update(uint32 p_time)
|
||||
}
|
||||
|
||||
// not auto-free ghost from body in instances
|
||||
if (m_deathTimer > 0 && !GetBaseMap()->Instanceable() && !HasAuraType(SPELL_AURA_PREVENT_RESURRECTION))
|
||||
if (m_deathTimer > 0 && !GetMap()->Instanceable() && !HasAuraType(SPELL_AURA_PREVENT_RESURRECTION))
|
||||
{
|
||||
if (p_time >= m_deathTimer)
|
||||
{
|
||||
@@ -2487,7 +2487,7 @@ GameObject* Player::GetGameObjectIfCanInteractWith(ObjectGuid const& guid, Gameo
|
||||
bool Player::IsUnderWater() const
|
||||
{
|
||||
return IsInWater() &&
|
||||
GetPositionZ() < (GetBaseMap()->GetWaterLevel(GetPhaseShift(), GetPositionX(), GetPositionY())-2);
|
||||
GetPositionZ() < (GetMap()->GetWaterLevel(GetPhaseShift(), GetPositionX(), GetPositionY())-2);
|
||||
}
|
||||
|
||||
void Player::SetInWater(bool apply)
|
||||
|
||||
@@ -3277,12 +3277,12 @@ bool Unit::isInAccessiblePlaceFor(Creature const* c) const
|
||||
|
||||
bool Unit::IsInWater() const
|
||||
{
|
||||
return GetBaseMap()->IsInWater(GetPhaseShift(), GetPositionX(), GetPositionY(), GetPositionZ());
|
||||
return GetMap()->IsInWater(GetPhaseShift(), GetPositionX(), GetPositionY(), GetPositionZ());
|
||||
}
|
||||
|
||||
bool Unit::IsUnderWater() const
|
||||
{
|
||||
return GetBaseMap()->IsUnderWater(GetPhaseShift(), GetPositionX(), GetPositionY(), GetPositionZ());
|
||||
return GetMap()->IsUnderWater(GetPhaseShift(), GetPositionX(), GetPositionY(), GetPositionZ());
|
||||
}
|
||||
|
||||
void Unit::ProcessPositionDataChanged(PositionFullTerrainStatus const& data)
|
||||
|
||||
@@ -386,7 +386,7 @@ void WorldSession::HandleMovementOpcodes(WorldPacket& recvPacket)
|
||||
if (plrMover && ((movementInfo.flags & MOVEMENTFLAG_SWIMMING) != 0) != plrMover->IsInWater())
|
||||
{
|
||||
// now client not include swimming flag in case jumping under water
|
||||
plrMover->SetInWater(!plrMover->IsInWater() || plrMover->GetBaseMap()->IsUnderWater(plrMover->GetPhaseShift(), movementInfo.pos.GetPositionX(), movementInfo.pos.GetPositionY(), movementInfo.pos.GetPositionZ()));
|
||||
plrMover->SetInWater(!plrMover->IsInWater() || plrMover->GetMap()->IsUnderWater(plrMover->GetPhaseShift(), movementInfo.pos.GetPositionX(), movementInfo.pos.GetPositionY(), movementInfo.pos.GetPositionZ()));
|
||||
}
|
||||
|
||||
uint32 mstime = GameTime::GetGameTimeMS();
|
||||
|
||||
@@ -2430,7 +2430,7 @@ GridMap* Map::GetGrid(uint32 mapId, float x, float y)
|
||||
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] && (*childMapItr)->GridMaps[gx][gy]->fileExists())
|
||||
if (childMapItr != m_childTerrainMaps->end() && (*childMapItr)->GridMaps[gx][gy]->fileExists())
|
||||
grid = (*childMapItr)->GridMaps[gx][gy];
|
||||
|
||||
return grid;
|
||||
|
||||
Reference in New Issue
Block a user