Browse Source

formatting

Dave Schuyler 20 years ago
parent
commit
1cb18155d0

+ 4 - 4
direct/src/distributed/CartesianGridBase.py

@@ -32,10 +32,10 @@ class CartesianGridBase:
         return zoneId
         return zoneId
 
 
     def getGridSizeFromSphereRadius(self, sphereRadius, cellWidth, gridRadius):
     def getGridSizeFromSphereRadius(self, sphereRadius, cellWidth, gridRadius):
-        # NOTE: This ensures that the grid is at least a "gridRadius" number of cells
-        # larger than the trigger sphere that loads the grid.  This gives us some
-        # room to start setting interest to the grid before we expect to see any objects
-        # on it.
+        # NOTE: This ensures that the grid is at least a "gridRadius" number
+        # of cells larger than the trigger sphere that loads the grid.  This
+        # gives us some room to start setting interest to the grid before we
+        # expect to see any objects on it.
         sphereRadius = max(sphereRadius, gridRadius*cellWidth)
         sphereRadius = max(sphereRadius, gridRadius*cellWidth)
         return 2 * (sphereRadius // cellWidth)
         return 2 * (sphereRadius // cellWidth)
 
 

+ 23 - 12
direct/src/distributed/DistributedCartesianGrid.py

@@ -71,8 +71,10 @@ class DistributedCartesianGrid(DistributedNode, CartesianGridBase):
         self.stopProcessVisibility()
         self.stopProcessVisibility()
         self.visAvatar = avatar
         self.visAvatar = avatar
         self.visZone = None
         self.visZone = None
-        self.gridVisContext = self.cr.addInterest(self.getDoId(), 0, self.uniqueName("visibility"))
-        taskMgr.add(self.processVisibility, self.taskName("processVisibility"))
+        self.gridVisContext = self.cr.addInterest(
+            self.getDoId(), 0, self.uniqueName("visibility"))
+        taskMgr.add(
+            self.processVisibility, self.taskName("processVisibility"))
 
 
     def stopProcessVisibility(self, clearAll=False):
     def stopProcessVisibility(self, clearAll=False):
         taskMgr.remove(self.taskName("processVisibility"))
         taskMgr.remove(self.taskName("processVisibility"))
@@ -95,7 +97,8 @@ class DistributedCartesianGrid(DistributedNode, CartesianGridBase):
         y = pos[1] + dx
         y = pos[1] + dx
         col = x // self.cellWidth
         col = x // self.cellWidth
         row = y // self.cellWidth
         row = y // self.cellWidth
-        assert self.notify.debug("processVisibility: %s: avatar pos: %s %s" % (self.doId, x, y))
+        assert self.notify.debug(
+            "processVisibility: %s: avatar pos: %s %s" % (self.doId, x, y))
         if (row < 0) or (col < 0) or (row > self.gridSize) or (col > self.gridSize):
         if (row < 0) or (col < 0) or (row > self.gridSize) or (col > self.gridSize):
             assert self.notify.debug("processVisibility: %s: not on the grid" % (self.doId))
             assert self.notify.debug("processVisibility: %s: not on the grid" % (self.doId))
             # If we are viewingRadius away from this entire grid,
             # If we are viewingRadius away from this entire grid,
@@ -110,26 +113,34 @@ class DistributedCartesianGrid(DistributedNode, CartesianGridBase):
         assert self.notify.debug("processVisibility: %s: row: %s col: %s zoneId: %s" %
         assert self.notify.debug("processVisibility: %s: row: %s col: %s zoneId: %s" %
                                  (self.doId, row, col, zoneId))
                                  (self.doId, row, col, zoneId))
         if (zoneId == self.visZone):
         if (zoneId == self.visZone):
-            assert self.notify.debug("processVisibility: %s: interest did not change" % (self.doId))
+            assert self.notify.debug(
+                "processVisibility: %s: interest did not change" % (self.doId))
             return Task.cont
             return Task.cont
         else:
         else:
-            assert self.notify.debug("processVisibility: %s: new interest" % (self.doId))
+            assert self.notify.debug(
+                "processVisibility: %s: new interest" % (self.doId))
             self.visZone = zoneId
             self.visZone = zoneId
             if not self.gridVisContext:
             if not self.gridVisContext:
-                self.gridVisContext = self.cr.addInterest(self.getDoId(), self.visZone,
-                                                      self.uniqueName("visibility"))
+                self.gridVisContext = self.cr.addInterest(
+                    self.getDoId(), self.visZone,
+                    self.uniqueName("visibility"))
             else:
             else:
-                assert self.notify.debug("processVisibility: %s: altering interest to zoneId: %s" %
-                                         (self.doId, zoneId))
-                self.cr.alterInterest(self.gridVisContext, self.getDoId(), self.visZone)
-                # If the visAvatar is parented to this grid, also do a setLocation
+                assert self.notify.debug(
+                    "processVisibility: %s: altering interest to zoneId: %s" %
+                    (self.doId, zoneId))
+                self.cr.alterInterest(
+                    self.gridVisContext, self.getDoId(), self.visZone)
+                # If the visAvatar is parented to this grid, also do a
+                # setLocation
                 parentId = self.visAvatar.parentId
                 parentId = self.visAvatar.parentId
                 oldZoneId = self.visAvatar.zoneId
                 oldZoneId = self.visAvatar.zoneId
                 assert self.notify.debug(
                 assert self.notify.debug(
                     "processVisibility: %s: parentId: %s oldZoneId: %s" %
                     "processVisibility: %s: parentId: %s oldZoneId: %s" %
                     (self.doId, parentId, oldZoneId))
                     (self.doId, parentId, oldZoneId))
                 if parentId == self.doId:
                 if parentId == self.doId:
-                    assert self.notify.debug("processVisibility: %s: changing location" % (self.doId))
+                    assert self.notify.debug(
+                        "processVisibility: %s: changing location" %
+                        (self.doId))
                     self.handleAvatarZoneChange(self.visAvatar, zoneId)
                     self.handleAvatarZoneChange(self.visAvatar, zoneId)
             return Task.cont
             return Task.cont
 
 

+ 5 - 3
direct/src/distributed/DistributedObjectAI.py

@@ -120,10 +120,12 @@ class DistributedObjectAI(DistributedObjectBase):
                 barrier.cleanup()
                 barrier.cleanup()
             self.__barriers = {}
             self.__barriers = {}
 
 
-            # DCR: I've re-enabled this block of code so that Toontown's AI won't leak channels.
+            # DCR: I've re-enabled this block of code so that Toontown's
+            # AI won't leak channels.
             # Let me know if it causes trouble.
             # Let me know if it causes trouble.
-            ### Asad: As per Roger's suggestion, turn off the following block until a solution is
-            ### Thought out of how to prevent this delete message or to handle this message better
+            ### Asad: As per Roger's suggestion, turn off the following
+            ### block until a solution is thought out of how to prevent
+            ### this delete message or to handle this message better
             # TODO: do we still need this check?
             # TODO: do we still need this check?
             if not hasattr(self, "doNotDeallocateChannel"):
             if not hasattr(self, "doNotDeallocateChannel"):
                 if self.air:
                 if self.air:

+ 2 - 2
direct/src/interval/MetaInterval.py

@@ -12,7 +12,6 @@ PREVIOUS_START = CMetaInterval.RSPreviousBegin
 TRACK_START = CMetaInterval.RSLevelBegin
 TRACK_START = CMetaInterval.RSLevelBegin
 
 
 class MetaInterval(CMetaInterval):
 class MetaInterval(CMetaInterval):
-
     # This is a Python-C++ hybrid class.  MetaInterval is a Python
     # This is a Python-C++ hybrid class.  MetaInterval is a Python
     # extension of the C++ class CMetaInterval, which adds some
     # extension of the C++ class CMetaInterval, which adds some
     # Python-specific features (like list management).
     # Python-specific features (like list management).
@@ -24,7 +23,8 @@ class MetaInterval(CMetaInterval):
     SequenceNum = 1
     SequenceNum = 1
     def __init__(self, *ivals, **kw):
     def __init__(self, *ivals, **kw):
         #if __debug__:
         #if __debug__:
-        #    self.debugInitTraceback = PythonUtil.StackTrace("create interval", 1, 10)
+        #    self.debugInitTraceback = PythonUtil.StackTrace(
+        #        "create interval", 1, 10)
 
 
         name = None
         name = None
         #if len(ivals) == 2 and isinstance(ivals[1], types.StringType):
         #if len(ivals) == 2 and isinstance(ivals[1], types.StringType):