From 1cb18155d054d1a344a256bd3fb88f20d2c43cf8 Mon Sep 17 00:00:00 2001 From: Dave Schuyler Date: Thu, 30 Mar 2006 03:09:31 +0000 Subject: [PATCH] formatting --- direct/src/distributed/CartesianGridBase.py | 8 ++--- .../distributed/DistributedCartesianGrid.py | 35 ++++++++++++------- direct/src/distributed/DistributedObjectAI.py | 8 +++-- direct/src/interval/MetaInterval.py | 4 +-- 4 files changed, 34 insertions(+), 21 deletions(-) diff --git a/direct/src/distributed/CartesianGridBase.py b/direct/src/distributed/CartesianGridBase.py index 78744d8c55..ff44451954 100755 --- a/direct/src/distributed/CartesianGridBase.py +++ b/direct/src/distributed/CartesianGridBase.py @@ -32,10 +32,10 @@ class CartesianGridBase: return zoneId 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) return 2 * (sphereRadius // cellWidth) diff --git a/direct/src/distributed/DistributedCartesianGrid.py b/direct/src/distributed/DistributedCartesianGrid.py index 9ba00da5eb..f1d7fe930b 100755 --- a/direct/src/distributed/DistributedCartesianGrid.py +++ b/direct/src/distributed/DistributedCartesianGrid.py @@ -71,8 +71,10 @@ class DistributedCartesianGrid(DistributedNode, CartesianGridBase): self.stopProcessVisibility() self.visAvatar = avatar 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): taskMgr.remove(self.taskName("processVisibility")) @@ -95,7 +97,8 @@ class DistributedCartesianGrid(DistributedNode, CartesianGridBase): y = pos[1] + dx col = x // 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): assert self.notify.debug("processVisibility: %s: not on the grid" % (self.doId)) # 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" % (self.doId, row, col, zoneId)) 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 else: - assert self.notify.debug("processVisibility: %s: new interest" % (self.doId)) + assert self.notify.debug( + "processVisibility: %s: new interest" % (self.doId)) self.visZone = zoneId 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: - 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 oldZoneId = self.visAvatar.zoneId assert self.notify.debug( "processVisibility: %s: parentId: %s oldZoneId: %s" % (self.doId, parentId, oldZoneId)) 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) return Task.cont diff --git a/direct/src/distributed/DistributedObjectAI.py b/direct/src/distributed/DistributedObjectAI.py index 08e3c5c813..7dc3e086c9 100644 --- a/direct/src/distributed/DistributedObjectAI.py +++ b/direct/src/distributed/DistributedObjectAI.py @@ -120,10 +120,12 @@ class DistributedObjectAI(DistributedObjectBase): barrier.cleanup() 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. - ### 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? if not hasattr(self, "doNotDeallocateChannel"): if self.air: diff --git a/direct/src/interval/MetaInterval.py b/direct/src/interval/MetaInterval.py index dd3f2d52e2..f1c7ac03eb 100644 --- a/direct/src/interval/MetaInterval.py +++ b/direct/src/interval/MetaInterval.py @@ -12,7 +12,6 @@ PREVIOUS_START = CMetaInterval.RSPreviousBegin TRACK_START = CMetaInterval.RSLevelBegin class MetaInterval(CMetaInterval): - # This is a Python-C++ hybrid class. MetaInterval is a Python # extension of the C++ class CMetaInterval, which adds some # Python-specific features (like list management). @@ -24,7 +23,8 @@ class MetaInterval(CMetaInterval): SequenceNum = 1 def __init__(self, *ivals, **kw): #if __debug__: - # self.debugInitTraceback = PythonUtil.StackTrace("create interval", 1, 10) + # self.debugInitTraceback = PythonUtil.StackTrace( + # "create interval", 1, 10) name = None #if len(ivals) == 2 and isinstance(ivals[1], types.StringType):