diff --git a/commands/run_cmd.py b/commands/run_cmd.py index 9dcb73bf..de8624ac 100644 --- a/commands/run_cmd.py +++ b/commands/run_cmd.py @@ -139,6 +139,12 @@ type=int, default=1 ), + ParseArgument('--max-gain-per-ton', '--mgpt', + help='Specify the minimum gain per ton of cargo', + dest='maxGainPerTon', + type=int, + default=10000 + ), ParseArgument('--unique', help='Only visit each station once.', action='store_true', diff --git a/tradecalc.py b/tradecalc.py index a1d84ec4..0cb25fee 100644 --- a/tradecalc.py +++ b/tradecalc.py @@ -684,13 +684,14 @@ def getProfitables(self, srcSelling, dstBuying): itemIdx = self.tdb.itemByID trading = [] minGainCr = max(1, self.tdenv.minGainPerTon or 1) + maxGainCr = max(1000, self.tdenv.maxGainPerTon or 10000) for buy in dstBuying: buyItemID = buy[0] for sell in srcSelling: sellItemID = sell[0] if sellItemID == buyItemID: buyCr, sellCr = buy[1], sell[1] - if sellCr + minGainCr <= buyCr: + if sellCr + minGainCr <= buyCr and sellCr + maxGainCr >= buyCr: trading.append(Trade( itemIdx[buyItemID], buyItemID,