コード例 #1
0
ファイル: DNAStorage.py プロジェクト: DarthNihilus1/src
 def getAdjacentPoints(self, point):
     path = DNASuitPath()
     startIndex = point.getIndex()
     if startIndex not in self.suitEdges:
         return path
     for edge in self.suitEdges[startIndex]:
         path.addPoint(edge.getEndPoint())
     return path
コード例 #2
0
 def getAdjacentPoints(self, point):
     path = DNASuitPath()
     startIndex = point.getIndex()
     if startIndex not in self.suitEdges:
         return path
     for edge in self.suitEdges[startIndex]:
         path.addPoint(edge.getEndPoint())
     return path
コード例 #3
0
ファイル: DNAStorage.py プロジェクト: DankMickey/Toontown-2.0
 def getSuitPath(self, startPoint, endPoint, minPathLen = 40, maxPathLen = 300, allowStreetOnly = False):
     path = DNASuitPath()
     
     while path.getNumPoints() < maxPathLen:
         startPointIndex = startPoint.getIndex()
         
         if startPointIndex == endPoint.getIndex():
             # reached the target
             # but if it's too short,
             # keep walking/moving
             if path.getNumPoints() >= minPathLen:
                 break
                 
         if startPointIndex not in self.suitEdges:
             raise DNAError('Could not find DNASuitPath.')
             
         edges = self.suitEdges[startPointIndex]
         
         #look for the first non-door (usually street) point
         streetPoint = None
         
         for edge in edges:
             startPoint = edge.getEndPoint()
             startPointType = startPoint.getPointType()
             
             # cog hq points are allowed as well
             isStreetPoint = startPointType not in (DNASuitPoint.pointTypeMap['FRONT_DOOR_POINT'], DNASuitPoint.pointTypeMap['SIDE_DOOR_POINT'])
             
             if isStreetPoint:
                 if streetPoint is None:
                     streetPoint = startPoint
                     
             else:
                 if allowStreetOnly:
                     continue
                     
                 elif startPoint.getIndex() == endPoint.getIndex():
                     # the end point is a door point
                     # and we found it
                     # add it to the path
                     # and return
                     if (path.getNumPoints() + 1) >= minPathLen:
                         path.addPoint(startPoint)
                         return path
                         
                     else:
                         # too bad, we didn't reach the minPathLen
                         pass
                     
         if streetPoint is None:
             raise DNAError('Could not find DNASuitPath.')
             
         else:
             startPoint = streetPoint
             
         path.addPoint(startPoint)
     
     return path
コード例 #4
0
 def getSuitPath(self, startPoint, endPoint, minPathLen = 40, maxPathLen = 300, allowStreetOnly = False):
     path = DNASuitPath()
     
     while path.getNumPoints() < maxPathLen:
         startPointIndex = startPoint.getIndex()
         
         if startPointIndex == endPoint.getIndex():
             # reached the target
             # but if it's too short,
             # keep walking/moving
             if path.getNumPoints() >= minPathLen:
                 break
                 
         if startPointIndex not in self.suitEdges:
             raise DNAError('Could not find DNASuitPath.')
             
         edges = self.suitEdges[startPointIndex]
         
         #look for the first non-door (usually street) point
         streetPoint = None
         
         for edge in edges:
             startPoint = edge.getEndPoint()
             startPointType = startPoint.getPointType()
             
             # cog hq points are allowed as well
             isStreetPoint = startPointType not in (DNASuitPoint.pointTypeMap['FRONT_DOOR_POINT'], DNASuitPoint.pointTypeMap['SIDE_DOOR_POINT'])
             
             if isStreetPoint:
                 if streetPoint is None:
                     streetPoint = startPoint
                     
             else:
                 if allowStreetOnly:
                     continue
                     
                 elif startPoint.getIndex() == endPoint.getIndex():
                     # the end point is a door point
                     # and we found it
                     # add it to the path
                     # and return
                     if (path.getNumPoints() + 1) >= minPathLen:
                         path.addPoint(startPoint)
                         return path
                         
                     else:
                         # too bad, we didn't reach the minPathLen
                         pass
                     
         if streetPoint is None:
             raise DNAError('Could not find DNASuitPath.')
             
         else:
             startPoint = streetPoint
             
         path.addPoint(startPoint)
     
     return path
コード例 #5
0
ファイル: DNAStorage.py プロジェクト: DarthNihilus1/src
 def getSuitPath(self, startPoint, endPoint, minPathLen=40, maxPathLen=300):
     path = DNASuitPath()
     path.addPoint(startPoint)
     while path.getNumPoints() < maxPathLen:
         startPointIndex = startPoint.getIndex()
         if startPointIndex == endPoint.getIndex():
             if path.getNumPoints() >= minPathLen:
                 break
         if startPointIndex not in self.suitEdges:
             raise DNAError('Could not find DNASuitPath.')
         edges = self.suitEdges[startPointIndex]
         for edge in edges:
             startPoint = edge.getEndPoint()
             startPointType = startPoint.getPointType()
             if startPointType != DNASuitPoint.FRONT_DOOR_POINT:
                 if startPointType != DNASuitPoint.SIDE_DOOR_POINT:
                     break
         else:
             raise DNAError('Could not find DNASuitPath.')
         path.addPoint(startPoint)
     return path
コード例 #6
0
 def getSuitPath(self, startPoint, endPoint, minPathLen=40, maxPathLen=300):
     path = DNASuitPath()
     path.addPoint(startPoint)
     while path.getNumPoints() < maxPathLen:
         startPointIndex = startPoint.getIndex()
         if startPointIndex == endPoint.getIndex():
             if path.getNumPoints() >= minPathLen:
                 break
         if startPointIndex not in self.suitEdges:
             raise DNAError('Could not find DNASuitPath.')
         edges = self.suitEdges[startPointIndex]
         for edge in edges:
             startPoint = edge.getEndPoint()
             startPointType = startPoint.getPointType()
             if startPointType != DNASuitPoint.FRONT_DOOR_POINT:
                 if startPointType != DNASuitPoint.SIDE_DOOR_POINT:
                     break
         else:
             raise DNAError('Could not find DNASuitPath.')
         path.addPoint(startPoint)
     return path