Skip to content

Commit

Permalink
Merged kfsone/tradedangerous into master
Browse files Browse the repository at this point in the history
  • Loading branch information
orphu committed Dec 10, 2014
2 parents f64c4f7 + 53f53a1 commit 206a02c
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ TradeDangerous, Copyright (C) Oliver "kfsone" Smith, July 2014
==============================================================================

v6.1.8 [wip]
. (kfsone) #79 support for "--avoid" in the "nav" command
. (kfsone) Download counter to "import", use -q to silence it
. (kfsone) Fixed case-sensitivity matching station names that changed
. (kfsone) 60 new stations
Expand Down
14 changes: 14 additions & 0 deletions commands/nav_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@
dest='aggressiveness',
default=0,
),
ParseArgument('--avoid',
help='Exclude a system from the route. If you specify a station, '
'the system that station is in will be avoided instead.',
action='append',
),
]

######################################################################
Expand Down Expand Up @@ -80,6 +85,13 @@ def getRoute(cmdenv, tdb, srcSystem, dstSystem, maxLyPer):
))
return None, None

avoiding = frozenset([
place.system if isinstance(place, Station) else place
for place in cmdenv.avoidPlaces
])
if avoiding:
cmdenv.DEBUG0("Avoiding: {}", list(avoiding))

# As long as the open list is not empty, keep iterating.
overshoot = (cmdenv.aggressiveness * 4) + 1
while openList:
Expand All @@ -95,6 +107,8 @@ def getRoute(cmdenv, tdb, srcSystem, dstSystem, maxLyPer):
gsir = tdb.genSystemsInRange
for node, startDist in openNodes.items():
for (destSys, destDistSq) in gsir(node, maxLyPer):
if destSys in avoiding:
continue
destDist = math.sqrt(destDistSq)
dist = startDist + destDist
# If we aready have a shorter path, do nothing
Expand Down
2 changes: 2 additions & 0 deletions corrections.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
'MANTOAC': "Mantóac",
"NANTOAC": "Nantóac",
"LIFTHRUTI": "Lífthruti",
"SETING": DELETED,

#ADD_SYSTEMS_HERE
}
Expand All @@ -23,6 +24,7 @@
"OPALA/ZAMK PLATFORM": "Zamka Platform",
"G 139-50/FILIPCHENKO": "Filipchenko City",
"AMARAK/WERNER VON SIEMENS VISON": "Werner Von Siemens Vision",
"SETING/COX LANDING": DELETED,

#ADD_STATIONS_HERE
}
Expand Down
1 change: 0 additions & 1 deletion data/Station.csv
Original file line number Diff line number Diff line change
Expand Up @@ -982,7 +982,6 @@ unq:[email protected]_id,unq:name,ls_from_star
'Ross 986','Jones Station',0.0
'Salarhul','Lavoisier Outpost',0.0
'Samkyha','Tesla Station',0.0
'Seting','Cox Landing',0.0
'Shama','Clairaut Port',0.0
'Shebayeb','Volta Landing',0.0
'Sheela Na Gig','Birkhoff Terminal',0.0
Expand Down
1 change: 0 additions & 1 deletion data/System.csv
Original file line number Diff line number Diff line change
Expand Up @@ -17174,7 +17174,6 @@ unq:name,pos_x,pos_y,pos_z,[email protected]_id,modified
'Setesuyara',-1.71875,-101.09375,38.5625,'Gamma','2014-11-26 15:19:00'
'Setet',18.96875,-63.09375,155.125,'Gamma','2014-11-26 15:19:00'
'Setetynas',-78.84375,-91.8125,105.09375,'Gamma','2014-11-26 15:19:00'
'Seting',-57.71875,7.875,-6.5,'Beta3 (unverified)','2014-11-01 06:36:37'
'Seurbi',-62.1875,-139.1875,0.59375,'Gamma','2014-11-26 15:19:00'
'Seurboda',83.03125,-191.96875,120.46875,'Gamma','2014-11-26 15:19:00'
'Seurici',42.8125,30.25,-147.5625,'Gamma','2014-11-26 15:19:00'
Expand Down

0 comments on commit 206a02c

Please sign in to comment.