diff --git a/CHANGES.txt b/CHANGES.txt index 6a61bba0..81bdd36c 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -2,7 +2,7 @@ TradeDangerous, Copyright (C) Oliver "kfsone" Smith, July 2014 ============================================================================== -v6.19.0 Apr 28 2015 +v6.19.0 May 01 2015 CACHE BUILD REQUIRED (trade.py buildcache -fi) . (kfsone) "import" command (non-plugin behavior) - Restored the default behavior of forcefully overwriting existing data @@ -19,11 +19,15 @@ CACHE BUILD REQUIRED (trade.py buildcache -fi) - Changed several command options from "--stock" to "--supply", . (kfsone) "market" command: - Only show the age of items once, +. (kfsone) "nav" command: + - Fixed --refuel-jumps + - Added --pad-size to limit which stations will be listed/refuelled at, . (kfsone) Performance: - Re-unified the StationBuying/StationSelling tables into StationItem, - Added StationBuying and StationSelling views, - Minor refactor of getTrades to reduce the pathalogical near O(n^2) behavior it used to match buyers to sellers, + - Improved performance of nav command slightly, v6.18.6 Apr 27 2015 diff --git a/README.txt b/README.txt index 939ad183..d9cc2e40 100644 --- a/README.txt +++ b/README.txt @@ -746,6 +746,15 @@ NAV sub-command: jump on the route have a station. "--ref 2" would require that you not make more than one stationless jump after another. + --pad-size ?SML + -p ?SML + Specify pad size required for a station to be listed or considered + for refuelling stops. Specify one or all pad sizes you are want, + DEFAULT: ?SML + e.g. + --pad-size=ML + -p ?SL (unknown, small or large) + from Name of the starting system or a station in the system, diff --git a/tradedb.py b/tradedb.py index 6e0bc316..fc59ccf9 100644 --- a/tradedb.py +++ b/tradedb.py @@ -968,6 +968,8 @@ def getRoute(self, origin, dest, maxJumpLy, avoiding=[], stationInterval=0): List of systems being avoided stationInterval: If non-zero, require a station at least this many jumps, + tdenv.padSize: + Controls the pad size of stations for refuelling Returns: None @@ -1025,6 +1027,15 @@ def getRoute(self, origin, dest, maxJumpLy, avoiding=[], stationInterval=0): destID = dest.ID sysByID = self.systemByID + maxPadSize = self.tdenv.padSize + if not maxPadSize: + checkStations = lambda system: bool(system.stations()) + else: + checkStations = lambda system: any( + stn for stn in system.stations + if stn.checkPadSize(maxPadSize) + ) + while openSet: weight, curDist, curSysID, stnDist = heappop(openSet) # If we reached 'goal' we've found the shortest path. @@ -1039,17 +1050,19 @@ def getRoute(self, origin, dest, maxJumpLy, avoiding=[], stationInterval=0): if curDist > distances[curSys][1]: continue + system_iter = iter(systemsInRange(curSys, maxJumpLy)) if stationInterval: - if curSys.stations: + if checkStations(curSys): stnDist = 0 else: stnDist += 1 + if stnDist >= stationInterval: + system_iter = iter( + v for v in system_iter if checkStations(v[0]) + ) distFn = curSys.distanceTo - for nSys, nDist in systemsInRange(curSys, maxJumpLy): - if stationInterval and stnDist >= stationInterval: - if not nSys.stations: - continue + for nSys, nDist in system_iter: newDist = curDist + nDist if getDist(nSys, defaultDist)[1] <= newDist: continue