From 666858f8e2b2d8b915ce785ff61a1fe291960ab5 Mon Sep 17 00:00:00 2001 From: walterroach <37820425+walterroach@users.noreply.github.com> Date: Thu, 17 Dec 2020 02:03:02 -0600 Subject: [PATCH] Fix Ground units ... don't move forward #601 --- game/theater/conflicttheater.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/game/theater/conflicttheater.py b/game/theater/conflicttheater.py index cb66d792..4e180e7a 100644 --- a/game/theater/conflicttheater.py +++ b/game/theater/conflicttheater.py @@ -487,11 +487,11 @@ class ConflictTheater: for inclusion_zone in self.landmap[0]: nearest_pair = ops.nearest_points(point, inclusion_zone) nearest_points.append(nearest_pair[1]) - min_distance = None # type: Optional[geometry.Point] - nearest_point = None # type: Optional[geometry.Point] - for pt in nearest_points: + min_distance = point.distance(nearest_points[0]) # type: geometry.Point + nearest_point = nearest_points[0] # type: geometry.Point + for pt in nearest_points[1:]: distance = point.distance(pt) - if not min_distance or distance < min_distance: + if distance < min_distance: min_distance = distance nearest_point = pt assert isinstance(nearest_point, geometry.Point)