summaryrefslogtreecommitdiff
path: root/src/game/g_utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/g_utils.c')
-rw-r--r--src/game/g_utils.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/game/g_utils.c b/src/game/g_utils.c
index 2d2690d4..870d781b 100644
--- a/src/game/g_utils.c
+++ b/src/game/g_utils.c
@@ -802,7 +802,8 @@ gentity_t *G_ClosestEnt( vec3_t origin, gentity_t **entities, int numEntities )
{
gentity_t *ent = entities[ i ];
- if( ( nd = Distance( origin, ent->s.origin ) ) < d )
+ nd = DistanceSquared( origin, ent->s.origin );
+ if( i == 0 || nd < d )
{
d = nd;
closestEnt = ent;