Skip to content

Commit

Permalink
Added max-gain-per-ton to the Run command
Browse files Browse the repository at this point in the history
  • Loading branch information
WombatFromHell committed Feb 24, 2015
1 parent 21a789f commit 2589560
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
6 changes: 6 additions & 0 deletions commands/run_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
3 changes: 2 additions & 1 deletion tradecalc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 2589560

Please sign in to comment.