From 555bc3ea93fc4bc3c8faeb3e0f2209ddfb8a06fc Mon Sep 17 00:00:00 2001 From: Oliver Smith Date: Sun, 11 Jan 2015 05:33:47 -0800 Subject: [PATCH] Fix for station-to-station route --- commands/run_cmd.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/commands/run_cmd.py b/commands/run_cmd.py index 02e8d4fd..a6f7b579 100644 --- a/commands/run_cmd.py +++ b/commands/run_cmd.py @@ -350,6 +350,30 @@ def checkAnchorNotInVia(hops, anchorName, place, viaSet): )) +def checkStationSuitability(cmdenv, station, src): + if not station.itemCount: + raise NoDataError( + "No price data in local database " + "for {} station: {}".format( + src, station.name(), + )) + mps = cmdenv.maxPadSize + if mps and not station.checkPadSize(mps): + raise CommandLineError( + "{} station {} does not meet pad-size " + "requirement.".format( + src, station.name(), + )) + if src != "--from": + bm = cmdenv.blackMarket + if bm and station.blackMarket != 'Y': + raise CommandLineError( + "{} station {} does not meet black-market " + "requirement.".format( + src, station.name(), + )) + + def filterStationSet(src, cmdenv, stnSet): if not stnSet: return stnSet @@ -405,6 +429,7 @@ def validateRunArguments(tdb, cmdenv): .format(cmdenv.origPlace.name()) ) else: + checkStationSuitability(cmdenv, cmdenv.origPlace, '--from') cmdenv.origins = [ cmdenv.origPlace ] cmdenv.startStation = cmdenv.origPlace cmdenv.origins = expandForJumps(