Update analyzer.py
This commit is contained in:
		
							parent
							
								
									fbfa08020b
								
							
						
					
					
						commit
						628791bf06
					
				@ -38,7 +38,7 @@ class Analyzer:
 | 
			
		||||
    return next(gates, None)
 | 
			
		||||
 | 
			
		||||
   
 | 
			
		||||
  def find_path(self, orig, to, depth=100):
 | 
			
		||||
  def find_path(self, orig, to, depth=100, seen=set()):
 | 
			
		||||
    if depth < 1: return None
 | 
			
		||||
    if type(orig) == System:
 | 
			
		||||
      orig = set([SearchNode(orig,None)])
 | 
			
		||||
@ -50,8 +50,10 @@ class Analyzer:
 | 
			
		||||
      jg = self.get_jumpgate(o.system)
 | 
			
		||||
      if jg is None: continue
 | 
			
		||||
      for s in jg.systems:
 | 
			
		||||
        if s in seen: continue
 | 
			
		||||
        seen.add(s)
 | 
			
		||||
        system = self.store.get(System, s)
 | 
			
		||||
        if system is None: continue
 | 
			
		||||
        dest.add(SearchNode(system, o))
 | 
			
		||||
    if len(dest) == 0: return None
 | 
			
		||||
    return  self.find_path(dest, to, depth-1)
 | 
			
		||||
    return  self.find_path(dest, to, depth-1, s)
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user