Skip to content

Commit

Permalink
"nav" now supports --via
Browse files Browse the repository at this point in the history
  • Loading branch information
Oliver Smith committed Dec 29, 2014
1 parent 0edd380 commit 79160af
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion commands/nav_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@
'the system that station is in will be avoided instead.',
action='append',
),
ParseArgument('--via',
help='Require specified systems/stations to be en-route (in order).',
action='append',
metavar='PLACE[,PLACE,...]',
),
]

######################################################################
Expand Down Expand Up @@ -126,7 +131,18 @@ def run(results, cmdenv, tdb):
cmdenv.DEBUG0("Route from {} to {} with max {}ly per jump.",
srcSystem.name(), dstSystem.name(), maxLyPer)

route = getRoute(cmdenv, tdb, srcSystem, dstSystem, maxLyPer)
# Build a list of src->dst pairs
hops = [ [ srcSystem, None ] ]
if cmdenv.viaPlaces:
for hop in cmdenv.viaPlaces:
hops[0][1] = hop
hops.insert(0, [hop, None])
hops[0][1] = dstSystem

route = [ ]
for hop in hops:
hopRoute = getRoute(cmdenv, tdb, hop[0], hop[1], maxLyPer)
route = route[:-1] + hopRoute

results.summary = ResultRow(
fromSys=srcSystem,
Expand Down

0 comments on commit 79160af

Please sign in to comment.