From 57f4e871bb820beaf56ee48e762a1ee276aa8afe Mon Sep 17 00:00:00 2001 From: Tycho Date: Tue, 15 Jul 2014 12:52:02 +0100 Subject: Fixed FindClosestPlayer --- src/World.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/World.cpp b/src/World.cpp index ba8add8f0..bd3613ce2 100644 --- a/src/World.cpp +++ b/src/World.cpp @@ -2468,10 +2468,13 @@ cPlayer * cWorld::FindClosestPlayer(const Vector3d & a_Pos, float a_SightLimit, if (Distance < ClosestDistance) { - if (a_CheckLineOfSight && !LineOfSight.Trace(a_Pos,(Pos - a_Pos),(int)(Pos - a_Pos).Length())) + if (a_CheckLineOfSight) { - ClosestDistance = Distance; - ClosestPlayer = *itr; + if(!LineOfSight.Trace(a_Pos,(Pos - a_Pos),(int)(Pos - a_Pos).Length())) + { + ClosestDistance = Distance; + ClosestPlayer = *itr; + } } else { -- cgit v1.2.3