summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2013-08-24 22:43:17 +0200
committermadmaxoft <github@xoft.cz>2013-08-24 22:43:17 +0200
commitde3aae5c75ded73c938d3fe690abdcbace4de36d (patch)
tree21d546b2cd8180f21bb275c8b515baa572f153a8 /source
parentcTracer doesn't attempt a trace above the world. (diff)
downloadcuberite-de3aae5c75ded73c938d3fe690abdcbace4de36d.tar
cuberite-de3aae5c75ded73c938d3fe690abdcbace4de36d.tar.gz
cuberite-de3aae5c75ded73c938d3fe690abdcbace4de36d.tar.bz2
cuberite-de3aae5c75ded73c938d3fe690abdcbace4de36d.tar.lz
cuberite-de3aae5c75ded73c938d3fe690abdcbace4de36d.tar.xz
cuberite-de3aae5c75ded73c938d3fe690abdcbace4de36d.tar.zst
cuberite-de3aae5c75ded73c938d3fe690abdcbace4de36d.zip
Diffstat (limited to 'source')
-rw-r--r--source/World.cpp9
1 files changed, 3 insertions, 6 deletions
diff --git a/source/World.cpp b/source/World.cpp
index 053eaedc7..1985f01ec 100644
--- a/source/World.cpp
+++ b/source/World.cpp
@@ -2202,15 +2202,12 @@ cPlayer * cWorld::FindClosestPlayer(const Vector3f & a_Pos, float a_SightLimit)
Vector3f Pos = (*itr)->GetPosition();
float Distance = (Pos - a_Pos).Length();
- if (Distance <= a_SightLimit)
+ if (Distance < ClosestDistance)
{
if (!LineOfSight.Trace(a_Pos,(Pos - a_Pos),(int)(Pos - a_Pos).Length()))
{
- if (Distance < ClosestDistance)
- {
- ClosestDistance = Distance;
- ClosestPlayer = *itr;
- }
+ ClosestDistance = Distance;
+ ClosestPlayer = *itr;
}
}
}