summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2014-07-15 14:12:17 +0200
committerMattes D <github@xoft.cz>2014-07-15 14:12:17 +0200
commit090cbad667b7ac56568cbb0a9d99dca9b8fa5e6b (patch)
tree2020d8860b75aa5a8247b048e13a497a143ca6af
parentPass cItem by reference. (diff)
parentFixed FindClosestPlayer (diff)
downloadcuberite-090cbad667b7ac56568cbb0a9d99dca9b8fa5e6b.tar
cuberite-090cbad667b7ac56568cbb0a9d99dca9b8fa5e6b.tar.gz
cuberite-090cbad667b7ac56568cbb0a9d99dca9b8fa5e6b.tar.bz2
cuberite-090cbad667b7ac56568cbb0a9d99dca9b8fa5e6b.tar.lz
cuberite-090cbad667b7ac56568cbb0a9d99dca9b8fa5e6b.tar.xz
cuberite-090cbad667b7ac56568cbb0a9d99dca9b8fa5e6b.tar.zst
cuberite-090cbad667b7ac56568cbb0a9d99dca9b8fa5e6b.zip
-rw-r--r--src/World.cpp9
1 files 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
{