Skip to content

Commit

Permalink
Keep track of numLinks in the TradeDB object itself
Browse files Browse the repository at this point in the history
  • Loading branch information
kfsone committed Oct 26, 2014
1 parent 78d059a commit a49b6e7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tradedb.py
Original file line number Diff line number Diff line change
Expand Up @@ -474,15 +474,15 @@ def buildLinks(self, longestJumpLy):
# Generate a series of symmetric pairs (A->B, A->C, A->D, B->C, B->D, C->D)
# so we only calculate each distance once, and then add a link each way.
# (A->B distance populates A->B and B->A, etc)
numLinks = 0
self.numLinks = 0
for (lhs, rhs) in itertools.combinations(self.systemByID.values(), 2):
dX, dY, dZ = rhs.posX - lhs.posX, rhs.posY - lhs.posY, rhs.posZ - lhs.posZ
distSq = (dX * dX) + (dY * dY) + (dZ * dZ)
if distSq <= longestJumpSq:
System.linkSystems(lhs, rhs, distSq)
numLinks += 1
self.numLinks += 1

if self.debug > 2: print("# Number of links between systems: %d" % numLinks)
if self.debug > 2: print("# Number of links between systems: %d" % self.numLinks)


def lookupSystem(self, key):
Expand Down

0 comments on commit a49b6e7

Please sign in to comment.