[Core] Fix .goname command (c2605)
This commit is contained in:
parent
edfd397ba3
commit
fb192cab4d
@ -1301,8 +1301,11 @@ void WorldObject::UpdateGroundPositionZ(float x, float y, float& z) const
|
||||
{ z = new_z + 0.05f; } // just to be sure that we are not a few pixel under the surface
|
||||
}
|
||||
|
||||
void WorldObject::UpdateAllowedPositionZ(float x, float y, float& z) const
|
||||
void WorldObject::UpdateAllowedPositionZ(float x, float y, float& z, Map* atMap /*=NULL*/) const
|
||||
{
|
||||
if (!atMap)
|
||||
atMap = GetMap();
|
||||
|
||||
switch (GetTypeId())
|
||||
{
|
||||
case TYPEID_UNIT:
|
||||
@ -1314,8 +1317,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
|
||||
? GetTerrain()->GetWaterOrGroundLevel(x, y, z, &ground_z, !((Unit const*)this)->HasAuraType(SPELL_AURA_WATER_WALK))
|
||||
: ((ground_z = GetMap()->GetHeight(x, y, z)));
|
||||
? atMap->GetTerrain()->GetWaterOrGroundLevel(x, y, z, &ground_z, !((Unit const*)this)->HasAuraType(SPELL_AURA_WATER_WALK))
|
||||
: ((ground_z = atMap->GetHeight(x, y, z)));
|
||||
if (max_z > INVALID_HEIGHT)
|
||||
{
|
||||
if (z > max_z)
|
||||
@ -1326,7 +1329,7 @@ void WorldObject::UpdateAllowedPositionZ(float x, float y, float& z) const
|
||||
}
|
||||
else
|
||||
{
|
||||
float ground_z = GetMap()->GetHeight(x, y, z);
|
||||
float ground_z = atMap->GetHeight(x, y, z);
|
||||
if (z < ground_z)
|
||||
{ z = ground_z; }
|
||||
}
|
||||
@ -1337,7 +1340,7 @@ void WorldObject::UpdateAllowedPositionZ(float x, float y, float& z) const
|
||||
// for server controlled moves player work same as creature (but it can always swim)
|
||||
{
|
||||
float ground_z = z;
|
||||
float max_z = GetTerrain()->GetWaterOrGroundLevel(x, y, z, &ground_z, !((Unit const*)this)->HasAuraType(SPELL_AURA_WATER_WALK));
|
||||
float max_z = atMap->GetTerrain()->GetWaterOrGroundLevel(x, y, z, &ground_z, !((Unit const*)this)->HasAuraType(SPELL_AURA_WATER_WALK));
|
||||
if (max_z > INVALID_HEIGHT)
|
||||
{
|
||||
if (z > max_z)
|
||||
@ -1350,7 +1353,7 @@ void WorldObject::UpdateAllowedPositionZ(float x, float y, float& z) const
|
||||
}
|
||||
default:
|
||||
{
|
||||
float ground_z = GetMap()->GetHeight(x, y, z);
|
||||
float ground_z = atMap->GetHeight(x, y, z);
|
||||
if (ground_z > INVALID_HEIGHT)
|
||||
{ z = ground_z; }
|
||||
break;
|
||||
@ -1734,7 +1737,7 @@ void WorldObject::GetNearPoint(WorldObject const* searcher, float& x, float& y,
|
||||
if (!sWorld.getConfig(CONFIG_BOOL_DETECT_POS_COLLISION))
|
||||
{
|
||||
if (searcher)
|
||||
{ searcher->UpdateAllowedPositionZ(x, y, z); } // update to LOS height if available
|
||||
{ searcher->UpdateAllowedPositionZ(x, y, z, GetMap()); } // update to LOS height if available
|
||||
else
|
||||
{ UpdateGroundPositionZ(x, y, z); }
|
||||
return;
|
||||
@ -1762,7 +1765,7 @@ void WorldObject::GetNearPoint(WorldObject const* searcher, float& x, float& y,
|
||||
if (selector.CheckOriginalAngle())
|
||||
{
|
||||
if (searcher)
|
||||
{ searcher->UpdateAllowedPositionZ(x, y, z); } // update to LOS height if available
|
||||
{ searcher->UpdateAllowedPositionZ(x, y, z, GetMap()); } // update to LOS height if available
|
||||
else
|
||||
{ UpdateGroundPositionZ(x, y, z); }
|
||||
|
||||
@ -1784,7 +1787,7 @@ void WorldObject::GetNearPoint(WorldObject const* searcher, float& x, float& y,
|
||||
z = GetPositionZ();
|
||||
|
||||
if (searcher)
|
||||
{ searcher->UpdateAllowedPositionZ(x, y, z); } // update to LOS height if available
|
||||
{ searcher->UpdateAllowedPositionZ(x, y, z, GetMap()); } // update to LOS height if available
|
||||
else
|
||||
{ UpdateGroundPositionZ(x, y, z); }
|
||||
|
||||
@ -1800,7 +1803,7 @@ void WorldObject::GetNearPoint(WorldObject const* searcher, float& x, float& y,
|
||||
y = first_y;
|
||||
|
||||
if (searcher)
|
||||
{ searcher->UpdateAllowedPositionZ(x, y, z); } // update to LOS height if available
|
||||
{ searcher->UpdateAllowedPositionZ(x, y, z, GetMap()); } // update to LOS height if available
|
||||
else
|
||||
{ UpdateGroundPositionZ(x, y, z); }
|
||||
return;
|
||||
@ -1816,7 +1819,7 @@ void WorldObject::GetNearPoint(WorldObject const* searcher, float& x, float& y,
|
||||
z = GetPositionZ();
|
||||
|
||||
if (searcher)
|
||||
{ searcher->UpdateAllowedPositionZ(x, y, z); } // update to LOS height if available
|
||||
{ searcher->UpdateAllowedPositionZ(x, y, z, GetMap()); } // update to LOS height if available
|
||||
else
|
||||
{ UpdateGroundPositionZ(x, y, z); }
|
||||
|
||||
@ -1829,7 +1832,7 @@ void WorldObject::GetNearPoint(WorldObject const* searcher, float& x, float& y,
|
||||
y = first_y;
|
||||
|
||||
if (searcher)
|
||||
{ searcher->UpdateAllowedPositionZ(x, y, z); } // update to LOS height if available
|
||||
{ searcher->UpdateAllowedPositionZ(x, y, z, GetMap()); } // update to LOS height if available
|
||||
else
|
||||
{ UpdateGroundPositionZ(x, y, z); }
|
||||
}
|
||||
|
@ -538,7 +538,7 @@ class WorldObject : public Object
|
||||
|
||||
bool IsPositionValid() const;
|
||||
void UpdateGroundPositionZ(float x, float y, float& z) const;
|
||||
void UpdateAllowedPositionZ(float x, float y, float& z) const;
|
||||
void UpdateAllowedPositionZ(float x, float y, float& z, Map* atMap = NULL) const;
|
||||
|
||||
void GetRandomPoint(float x, float y, float z, float distance, float& rand_x, float& rand_y, float& rand_z, float minDist = 0.0f, float const* ori = NULL) const;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user