mirror of
https://github.com/mangosfour/server.git
synced 2025-12-15 19:37:02 +00:00
[10727] Map system re-engineered. Special thanks to Blueboy for tests.
Signed-off-by: Ambal <pogrebniak@gala.net>
This commit is contained in:
parent
f5e40a5fda
commit
f67d89f109
43 changed files with 1254 additions and 1128 deletions
|
|
@ -1160,17 +1160,17 @@ void WorldObject::Relocate(float x, float y, float z)
|
|||
|
||||
uint32 WorldObject::GetZoneId() const
|
||||
{
|
||||
return GetBaseMap()->GetZoneId(m_positionX, m_positionY, m_positionZ);
|
||||
return GetTerrain()->GetZoneId(m_positionX, m_positionY, m_positionZ);
|
||||
}
|
||||
|
||||
uint32 WorldObject::GetAreaId() const
|
||||
{
|
||||
return GetBaseMap()->GetAreaId(m_positionX, m_positionY, m_positionZ);
|
||||
return GetTerrain()->GetAreaId(m_positionX, m_positionY, m_positionZ);
|
||||
}
|
||||
|
||||
void WorldObject::GetZoneAndAreaId(uint32& zoneid, uint32& areaid) const
|
||||
{
|
||||
GetBaseMap()->GetZoneAndAreaId(zoneid, areaid, m_positionX, m_positionY, m_positionZ);
|
||||
GetTerrain()->GetZoneAndAreaId(zoneid, areaid, m_positionX, m_positionY, m_positionZ);
|
||||
}
|
||||
|
||||
InstanceData* WorldObject::GetInstanceData() const
|
||||
|
|
@ -1458,7 +1458,7 @@ void WorldObject::GetRandomPoint( float x, float y, float z, float distance, flo
|
|||
|
||||
void WorldObject::UpdateGroundPositionZ(float x, float y, float &z) const
|
||||
{
|
||||
float new_z = GetBaseMap()->GetHeight(x,y,z,true);
|
||||
float new_z = GetTerrain()->GetHeight(x,y,z,true);
|
||||
if(new_z > INVALID_HEIGHT)
|
||||
z = new_z+ 0.05f; // just to be sure that we are not a few pixel under the surface
|
||||
}
|
||||
|
|
@ -1476,8 +1476,8 @@ void WorldObject::UpdateAllowedPositionZ(float x, float y, float &z) const
|
|||
bool CanSwim = ((Creature const*)this)->CanSwim();
|
||||
float ground_z = z;
|
||||
float max_z = CanSwim
|
||||
? GetBaseMap()->GetWaterOrGroundLevel(x, y, z, &ground_z, !((Unit const*)this)->HasAuraType(SPELL_AURA_WATER_WALK))
|
||||
: ((ground_z = GetBaseMap()->GetHeight(x, y, z, true)));
|
||||
? GetTerrain()->GetWaterOrGroundLevel(x, y, z, &ground_z, !((Unit const*)this)->HasAuraType(SPELL_AURA_WATER_WALK))
|
||||
: ((ground_z = GetTerrain()->GetHeight(x, y, z, true)));
|
||||
if (max_z > INVALID_HEIGHT)
|
||||
{
|
||||
if (z > max_z)
|
||||
|
|
@ -1488,7 +1488,7 @@ void WorldObject::UpdateAllowedPositionZ(float x, float y, float &z) const
|
|||
}
|
||||
else
|
||||
{
|
||||
float ground_z = GetBaseMap()->GetHeight(x, y, z, true);
|
||||
float ground_z = GetTerrain()->GetHeight(x, y, z, true);
|
||||
if (z < ground_z)
|
||||
z = ground_z;
|
||||
}
|
||||
|
|
@ -1500,7 +1500,7 @@ void WorldObject::UpdateAllowedPositionZ(float x, float y, float &z) const
|
|||
if (!((Player const*)this)->CanFly())
|
||||
{
|
||||
float ground_z = z;
|
||||
float max_z = GetBaseMap()->GetWaterOrGroundLevel(x, y, z, &ground_z, !((Unit const*)this)->HasAuraType(SPELL_AURA_WATER_WALK));
|
||||
float max_z = GetTerrain()->GetWaterOrGroundLevel(x, y, z, &ground_z, !((Unit const*)this)->HasAuraType(SPELL_AURA_WATER_WALK));
|
||||
if (max_z > INVALID_HEIGHT)
|
||||
{
|
||||
if (z > max_z)
|
||||
|
|
@ -1511,7 +1511,7 @@ void WorldObject::UpdateAllowedPositionZ(float x, float y, float &z) const
|
|||
}
|
||||
else
|
||||
{
|
||||
float ground_z = GetBaseMap()->GetHeight(x, y, z, true);
|
||||
float ground_z = GetTerrain()->GetHeight(x, y, z, true);
|
||||
if (z < ground_z)
|
||||
z = ground_z;
|
||||
}
|
||||
|
|
@ -1519,7 +1519,7 @@ void WorldObject::UpdateAllowedPositionZ(float x, float y, float &z) const
|
|||
}
|
||||
default:
|
||||
{
|
||||
float ground_z = GetBaseMap()->GetHeight(x, y, z, true);
|
||||
float ground_z = GetTerrain()->GetHeight(x, y, z, true);
|
||||
if(ground_z > INVALID_HEIGHT)
|
||||
z = ground_z;
|
||||
break;
|
||||
|
|
@ -1713,10 +1713,10 @@ void WorldObject::SetMap(Map * map)
|
|||
m_InstanceId = map->GetInstanceId();
|
||||
}
|
||||
|
||||
Map const* WorldObject::GetBaseMap() const
|
||||
TerrainInfo const* WorldObject::GetTerrain() const
|
||||
{
|
||||
MANGOS_ASSERT(m_currMap);
|
||||
return m_currMap->GetParent();
|
||||
return m_currMap->GetTerrain();
|
||||
}
|
||||
|
||||
void WorldObject::AddObjectToRemoveList()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue