Skip to content

Commit

Permalink
Merged kfsone/tradedangerous into master
Browse files Browse the repository at this point in the history
  • Loading branch information
maddavo committed Apr 13, 2015
2 parents 276c4e5 + da6bf0a commit fec9815
Show file tree
Hide file tree
Showing 13 changed files with 1,424 additions and 540 deletions.
6 changes: 6 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
TradeDangerous, Copyright (C) Oliver "kfsone" Smith, July 2014
==============================================================================

v6.18.0 Apr 11 2015
. (kfsone) #215 removed "AltItemName" table
. (kfsone) #216 fixed a crash when using "direct" cleanly
+ Apr 09 2015: ~200 new systems
. Apr 11 2015: ~100 new systems

v6.17.5 Apr 08 2015
. (kfsone) Fixed problem with 'import' not updating dates

Expand Down
1 change: 0 additions & 1 deletion README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1007,7 +1007,6 @@ EXPORT sub-command:
> trade.py export --path misc
Using database './data/TradeDangerous.db'
Export Table 'Added' to 'misc/Added.csv'
Export Table 'AltItemNames' to 'misc/AltItemNames.csv'
Export Table 'Category' to 'misc/Category.csv'
Export Table 'Item' to 'misc/Item.csv'
Export Table 'Ship' to 'misc/Ship.csv'
Expand Down
3 changes: 1 addition & 2 deletions TradeDangerous.pyproj
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@
<ItemGroup>
<Content Include="CHANGES.txt" />
<Content Include="data\Added.csv" />
<Content Include="data\AltItemNames.csv" />
<Content Include="data\Category.csv" />
<Content Include="data\Item.csv" />
<Content Include="data\Ship.csv" />
Expand All @@ -83,4 +82,4 @@
</ItemGroup>
<Import Project="$(PtvsTargetsFile)" Condition="Exists($(PtvsTargetsFile))" />
<Import Project="$(MSBuildToolsPath)\Microsoft.Common.targets" Condition="!Exists($(PtvsTargetsFile))" />
</Project>
</Project>
38 changes: 21 additions & 17 deletions commands/run_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,24 +68,26 @@
'e.g. "dom.App" or "domap" matches "Dom. Appliances".',
action='append',
),
ParseArgument('--hops',
help='Number of hops (station-to-station) to run.',
default=2,
type=int,
metavar='N',
MutuallyExclusiveGroup(
ParseArgument('--direct',
help="Assume destinations are reachable without worrying "
"about jumps.",
action='store_true',
),
ParseArgument('--hops',
help='Number of hops (station-to-station) to run.',
default=2,
type=int,
metavar='N',
),
),
ParseArgument('--jumps-per',
help='Maximum number of jumps (system-to-system) per hop.',
default=2,
dest='maxJumpsPer',
metavar='N',
type=int,
),
ParseArgument('--direct',
help="Assume destinations are reachable without worrying "
"about jumps.",
action='store_true',
),
ParseArgument('--ly-per',
help='Maximum light years per jump.',
dest='maxLyPer',
Expand Down Expand Up @@ -724,16 +726,17 @@ def validateRunArguments(tdb, cmdenv, calc):
raise CommandLineError("Negative jumps: you're already there?")
if cmdenv.direct:
cmdenv.hops = 1
cmdenv.maxJumpsPer = cmdenv.maxLyPer = 10000

if cmdenv.capacity is None:
raise CommandLineError("Missing '--capacity'")
if cmdenv.maxLyPer is None and not cmdenv.direct:
raise CommandLineError("Missing '--ly-per'")
if cmdenv.capacity < 0:
raise CommandLineError("Invalid (negative) cargo capacity")
if cmdenv.capacity > 1200:
if cmdenv.capacity > 1500:
raise CommandLineError(
"Capacity > 1200 not supported (you specified {})"
"Capacity > 1500 not supported (you specified {})"
.format( cmdenv.capacity)
)

Expand Down Expand Up @@ -851,8 +854,8 @@ def validateRunArguments(tdb, cmdenv, calc):
cmdenv.mfd.display("Loading Trades")

if cmdenv.pruneScores and cmdenv.pruneHops:
if cmdenv.pruneScores > 100:
raise CommandLineError("--prune-score value percentile exceed 100.")
if cmdenv.pruneScores > 99:
raise CommandLineError("--prune-score value percentile exceed 99.")
if cmdenv.pruneHops < 2:
raise CommandLineError("--prune-hops must 2 or more.")
else:
Expand Down Expand Up @@ -1023,7 +1026,6 @@ def run(results, cmdenv, tdb):
stopStations = cmdenv.destinations
goalSystem = cmdenv.goalSystem
maxLs = cmdenv.maxLs
maxHopDistLy = cmdenv.maxJumpsPer * cmdenv.maxLyPer

# seed the route table with starting places
startCr = cmdenv.credits - cmdenv.insurance
Expand Down Expand Up @@ -1051,8 +1053,10 @@ def run(results, cmdenv, tdb):

pruneMod = cmdenv.pruneScores / 100
distancePruning = (cmdenv.destPlace and not cmdenv.direct) or (cmdenv.loop)
if distancePruning and not cmdenv.loop:
stopSystems = {stop.system for stop in stopStations}
if distancePruning:
maxHopDistLy = cmdenv.maxJumpsPer * cmdenv.maxLyPer
if not cmdenv.loop:
stopSystems = {stop.system for stop in stopStations}

loopRoutes = []
for hopNo in range(numHops):
Expand Down
16 changes: 10 additions & 6 deletions corrections.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,16 @@
"LHS 3006/WCM TRANSFER ORBITAL": "Leonard Nimoy Station",
"LALANDE 4141/4A5O4O": "4A5O4D",
"NEW YEMBO/UNDER CONSTRUCTION": DELETED,
"GENDINI/Houtman Gateway": DELETED,
"QUECHE/Rutherford Works": DELETED,
"SALARHUL/Lavoisier Outpost": DELETED,
"TELIU YUAN/Buchli Station": DELETED,
"WUNJO/Baudin Hanger": "Baudin Hangar",
"WYRD/Vonarburg Co-Operative": "Vonarburg Co-operative",
"GENDINI/HOUTMAN GATEWAY": DELETED,
"QUECHE/RUTHERFORD WORKS": DELETED,
"SALARHUL/LAVOISIER OUTPOST": DELETED,
"TELIU YUAN/BUCHLI STATION": DELETED,
"WUNJO/BAUDIN HANGER": "Baudin Hangar",
"WYRD/VONARBURG CO-OPERATIVE": "Vonarburg Co-operative",
"APALA/FODA PORT": DELETED,
"BD+47 2112/OLIVAS SETTLEMENT": DELETED,
"BPM 89444/AL-HAYTHAM PORT": "al-Haytham Port",
"HR 5243/PAULO DA GAMA STATION": "Paulo da Gama Station",
}

categories = {
Expand Down
12 changes: 6 additions & 6 deletions csvexport.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@
# Default values

# for some tables the first two columns will be reversed
reverseList = [ 'AltItemNames',
'Item',
'ShipVendor',
'Station',
'StationBuying',
'UpgradeVendor',
reverseList = [
'Item',
'ShipVendor',
'Station',
'StationBuying',
'UpgradeVendor',
]

######################################################################
Expand Down
4 changes: 2 additions & 2 deletions data/RareItem.csv
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
'CHI ERIDANI','Steve Masters','Chi Eridani Marine Paste',784,18
'COQUIM','Hirayama Installation','Coquim Spongiform Victuals',255,20
'DAMNA','Nemere Market','Damna Carapaces',315,0
'DEA MOTRONA','Pinzon Dock','Motrona Experience Jelly',7420,0
'DEA MOTRONA','Pinzon Dock','Motrona Experience Jelly',7420,10
'DELTA PHOENICIS','Trading Post','Delta Phoenicis Palms',412,17
'DEURINGAS','Shukor Hub','Deuringas Truffles',1892,0
'DISO','Shifnalport','Diso Ma Corn',180,15
Expand All @@ -40,7 +40,7 @@
'HAVASUPAI','Lovelace Port','Havasupai Dream Catcher',9636,0
'HECATE','RJH1972','Live Hecate Sea Worms',1190,13
'HEIKE','Brunel City','Ceremonial Heike Tea',0,8
'HELVETITJ','Friend Orbital','Helvetitj Pearls',1810,0
'HELVETITJ','Friend Orbital','Helvetitj Pearls',3620,6
'HIP 10175','Stefanyshyn-Piper Station','HIP 10175 Bush Meat',2105,13
'HIP 41181','Andersson Station','HIP Proto-Squid',1488,0
'HIP 59533','Burnham Beacon','Burnham Bile Distillate',806,0
Expand Down
Loading

0 comments on commit fec9815

Please sign in to comment.