mirror of
https://github.com/mangosfour/server.git
synced 2025-12-18 19:37:01 +00:00
[11919] Improve GetNearPoint
This commit is contained in:
parent
d0bdf7611a
commit
6c8000705f
2 changed files with 8 additions and 6 deletions
|
|
@ -1669,7 +1669,7 @@ void WorldObject::GetNearPoint2D(float &x, float &y, float distance2d, float abs
|
||||||
void WorldObject::GetNearPoint(WorldObject const* searcher, float &x, float &y, float &z, float searcher_bounding_radius, float distance2d, float absAngle) const
|
void WorldObject::GetNearPoint(WorldObject const* searcher, float &x, float &y, float &z, float searcher_bounding_radius, float distance2d, float absAngle) const
|
||||||
{
|
{
|
||||||
GetNearPoint2D(x, y, distance2d + searcher_bounding_radius, absAngle);
|
GetNearPoint2D(x, y, distance2d + searcher_bounding_radius, absAngle);
|
||||||
z = GetPositionZ();
|
const float init_z = z = GetPositionZ();
|
||||||
|
|
||||||
// if detection disabled, return first point
|
// if detection disabled, return first point
|
||||||
if(!sWorld.getConfig(CONFIG_BOOL_DETECT_POS_COLLISION))
|
if(!sWorld.getConfig(CONFIG_BOOL_DETECT_POS_COLLISION))
|
||||||
|
|
@ -1686,8 +1686,10 @@ void WorldObject::GetNearPoint(WorldObject const* searcher, float &x, float &y,
|
||||||
float first_y = y;
|
float first_y = y;
|
||||||
bool first_los_conflict = false; // first point LOS problems
|
bool first_los_conflict = false; // first point LOS problems
|
||||||
|
|
||||||
|
const float dist = distance2d + searcher_bounding_radius + GetObjectBoundingRadius();
|
||||||
|
|
||||||
// prepare selector for work
|
// prepare selector for work
|
||||||
ObjectPosSelector selector(GetPositionX(), GetPositionY(), distance2d + searcher_bounding_radius + GetObjectBoundingRadius(), searcher_bounding_radius);
|
ObjectPosSelector selector(GetPositionX(), GetPositionY(), dist, searcher_bounding_radius);
|
||||||
|
|
||||||
// adding used positions around object
|
// adding used positions around object
|
||||||
{
|
{
|
||||||
|
|
@ -1705,7 +1707,7 @@ void WorldObject::GetNearPoint(WorldObject const* searcher, float &x, float &y,
|
||||||
else
|
else
|
||||||
UpdateGroundPositionZ(x, y, z);
|
UpdateGroundPositionZ(x, y, z);
|
||||||
|
|
||||||
if (IsWithinLOS(x, y, z))
|
if (fabs(init_z - z) < dist && IsWithinLOS(x, y, z))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
first_los_conflict = true; // first point have LOS problems
|
first_los_conflict = true; // first point have LOS problems
|
||||||
|
|
@ -1727,7 +1729,7 @@ void WorldObject::GetNearPoint(WorldObject const* searcher, float &x, float &y,
|
||||||
else
|
else
|
||||||
UpdateGroundPositionZ(x, y, z);
|
UpdateGroundPositionZ(x, y, z);
|
||||||
|
|
||||||
if (IsWithinLOS(x, y, z))
|
if (fabs(init_z - z) < dist && IsWithinLOS(x, y, z))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1759,7 +1761,7 @@ void WorldObject::GetNearPoint(WorldObject const* searcher, float &x, float &y,
|
||||||
else
|
else
|
||||||
UpdateGroundPositionZ(x, y, z);
|
UpdateGroundPositionZ(x, y, z);
|
||||||
|
|
||||||
if (IsWithinLOS(x, y, z))
|
if (fabs(init_z - z) < dist && IsWithinLOS(x, y, z))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "11918"
|
#define REVISION_NR "11919"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue