[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
|
{ 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())
|
switch (GetTypeId())
|
||||||
{
|
{
|
||||||
case TYPEID_UNIT:
|
case TYPEID_UNIT:
|
||||||
@ -1314,8 +1317,8 @@ void WorldObject::UpdateAllowedPositionZ(float x, float y, float& z) const
|
|||||||
bool canSwim = ((Creature const*)this)->CanSwim();
|
bool canSwim = ((Creature const*)this)->CanSwim();
|
||||||
float ground_z = z;
|
float ground_z = z;
|
||||||
float max_z = canSwim
|
float max_z = canSwim
|
||||||
? GetTerrain()->GetWaterOrGroundLevel(x, y, z, &ground_z, !((Unit const*)this)->HasAuraType(SPELL_AURA_WATER_WALK))
|
? atMap->GetTerrain()->GetWaterOrGroundLevel(x, y, z, &ground_z, !((Unit const*)this)->HasAuraType(SPELL_AURA_WATER_WALK))
|
||||||
: ((ground_z = GetMap()->GetHeight(x, y, z)));
|
: ((ground_z = atMap->GetHeight(x, y, z)));
|
||||||
if (max_z > INVALID_HEIGHT)
|
if (max_z > INVALID_HEIGHT)
|
||||||
{
|
{
|
||||||
if (z > max_z)
|
if (z > max_z)
|
||||||
@ -1326,7 +1329,7 @@ void WorldObject::UpdateAllowedPositionZ(float x, float y, float& z) const
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
float ground_z = GetMap()->GetHeight(x, y, z);
|
float ground_z = atMap->GetHeight(x, y, z);
|
||||||
if (z < ground_z)
|
if (z < ground_z)
|
||||||
{ 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)
|
// for server controlled moves player work same as creature (but it can always swim)
|
||||||
{
|
{
|
||||||
float ground_z = z;
|
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 (max_z > INVALID_HEIGHT)
|
||||||
{
|
{
|
||||||
if (z > max_z)
|
if (z > max_z)
|
||||||
@ -1350,7 +1353,7 @@ void WorldObject::UpdateAllowedPositionZ(float x, float y, float& z) const
|
|||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
float ground_z = GetMap()->GetHeight(x, y, z);
|
float ground_z = atMap->GetHeight(x, y, z);
|
||||||
if (ground_z > INVALID_HEIGHT)
|
if (ground_z > INVALID_HEIGHT)
|
||||||
{ z = ground_z; }
|
{ z = ground_z; }
|
||||||
break;
|
break;
|
||||||
@ -1734,7 +1737,7 @@ void WorldObject::GetNearPoint(WorldObject const* searcher, float& x, float& y,
|
|||||||
if (!sWorld.getConfig(CONFIG_BOOL_DETECT_POS_COLLISION))
|
if (!sWorld.getConfig(CONFIG_BOOL_DETECT_POS_COLLISION))
|
||||||
{
|
{
|
||||||
if (searcher)
|
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
|
else
|
||||||
{ UpdateGroundPositionZ(x, y, z); }
|
{ UpdateGroundPositionZ(x, y, z); }
|
||||||
return;
|
return;
|
||||||
@ -1762,7 +1765,7 @@ void WorldObject::GetNearPoint(WorldObject const* searcher, float& x, float& y,
|
|||||||
if (selector.CheckOriginalAngle())
|
if (selector.CheckOriginalAngle())
|
||||||
{
|
{
|
||||||
if (searcher)
|
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
|
else
|
||||||
{ UpdateGroundPositionZ(x, y, z); }
|
{ UpdateGroundPositionZ(x, y, z); }
|
||||||
|
|
||||||
@ -1784,7 +1787,7 @@ void WorldObject::GetNearPoint(WorldObject const* searcher, float& x, float& y,
|
|||||||
z = GetPositionZ();
|
z = GetPositionZ();
|
||||||
|
|
||||||
if (searcher)
|
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
|
else
|
||||||
{ UpdateGroundPositionZ(x, y, z); }
|
{ UpdateGroundPositionZ(x, y, z); }
|
||||||
|
|
||||||
@ -1800,7 +1803,7 @@ void WorldObject::GetNearPoint(WorldObject const* searcher, float& x, float& y,
|
|||||||
y = first_y;
|
y = first_y;
|
||||||
|
|
||||||
if (searcher)
|
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
|
else
|
||||||
{ UpdateGroundPositionZ(x, y, z); }
|
{ UpdateGroundPositionZ(x, y, z); }
|
||||||
return;
|
return;
|
||||||
@ -1816,7 +1819,7 @@ void WorldObject::GetNearPoint(WorldObject const* searcher, float& x, float& y,
|
|||||||
z = GetPositionZ();
|
z = GetPositionZ();
|
||||||
|
|
||||||
if (searcher)
|
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
|
else
|
||||||
{ UpdateGroundPositionZ(x, y, z); }
|
{ UpdateGroundPositionZ(x, y, z); }
|
||||||
|
|
||||||
@ -1829,7 +1832,7 @@ void WorldObject::GetNearPoint(WorldObject const* searcher, float& x, float& y,
|
|||||||
y = first_y;
|
y = first_y;
|
||||||
|
|
||||||
if (searcher)
|
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
|
else
|
||||||
{ UpdateGroundPositionZ(x, y, z); }
|
{ UpdateGroundPositionZ(x, y, z); }
|
||||||
}
|
}
|
||||||
|
@ -538,7 +538,7 @@ class WorldObject : public Object
|
|||||||
|
|
||||||
bool IsPositionValid() const;
|
bool IsPositionValid() const;
|
||||||
void UpdateGroundPositionZ(float x, float y, float& z) 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;
|
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