From f5383abb2a64ffa84ffa29db114b4897ab6e9bc7 Mon Sep 17 00:00:00 2001 From: Oliver Smith Date: Mon, 1 Sep 2014 09:40:41 -0700 Subject: [PATCH] Fix for avoiding stations not working --- tradedb.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tradedb.py b/tradedb.py index 32b1a1ad..7db73014 100644 --- a/tradedb.py +++ b/tradedb.py @@ -149,11 +149,11 @@ def getDestinations(self, maxJumps=None, maxLyPer=None, avoiding=None): openList = [ Node(self.system, [], 0) ] pathList = { system.ID: Node(system, None, 0.0) - # include avoids so we only have - # to consult one place for exclusions + # include avoids so we only have + # to consult one place for exclusions for system in avoiding + [ self ] - # the avoid list may contain stations, - # which affects destinations but not vias + # the avoid list may contain stations, + # which affects destinations but not vias if isinstance(system, System) } # As long as the open list is not empty, keep iterating. @@ -197,7 +197,8 @@ def getDestinations(self, maxJumps=None, maxLyPer=None, avoiding=None): for node in pathList.values(): if node.distLy > epsilon: # Values indistinguishable from zero are avoidances for station in node.system.stations: - destStations += [ Destination(node.system, station, [self.system] + node.via + [station.system], node.distLy) ] + if not station in avoidStations: + destStations += [ Destination(node.system, station, [self.system] + node.via + [station.system], node.distLy) ] return destStations