asserting notify statements to clean up the game logs

This commit is contained in:
Josh Wilson 2008-07-09 01:37:58 +00:00
parent d2e689f8d3
commit a480d86b62
6 changed files with 35 additions and 10 deletions

View File

@ -483,7 +483,7 @@ class Actor(DirectObject, NodePath):
def removeNode(self):
if self.__geomNode and (self.__geomNode.getNumChildren() > 0):
self.notify.warning("called actor.removeNode() on %s without calling cleanup()" % self.getName())
assert self.notify.warning("called actor.removeNode() on %s without calling cleanup()" % self.getName())
NodePath.removeNode(self)
def clearPythonData(self):

View File

@ -22,7 +22,6 @@ class ControlManager:
wantWASD = config.GetBool('want-WASD', 0)
def __init__(self, enable=True, passMessagesThrough = False):
print ("init control manager %s" % (passMessagesThrough))
assert self.notify.debugCall(id(self))
self.passMessagesThrough = passMessagesThrough
self.inputStateTokens = []

View File

@ -7,6 +7,7 @@ from direct.task import Task
from direct.gui import DirectGuiGlobals
from direct.showbase.EventGroup import EventGroup
from direct.showbase.PythonUtil import report
from direct.distributed.GridParent import GridParent
if __debug__:
# For grid drawing
@ -76,6 +77,31 @@ class DistributedCartesianGrid(DistributedNode, CartesianGridBase):
def getCenterPos(self):
return self.centerPos
def handleChildArrive(self, child, zoneId):
DistributedNode.handleChildArrive(self, child, zoneId)
if (zoneId >= self.startingZone):
if not child.gridParent:
child.gridParent = GridParent(child)
child.gridParent.setGridParent(self, zoneId)
elif child.gridParent:
child.gridParent.delete()
child.gridParent = None
def handleChildArriveZone(self, child, zoneId):
DistributedNode.handleChildArrive(self, child, zoneId)
if (zoneId >= self.startingZone):
if not child.gridParent:
child.gridParent = GridParent(child)
child.gridParent.setGridParent(self, zoneId)
elif child.gridParent:
child.gridParent.delete()
child.gridParent = None
def handleChildLeave(self, child, zoneId):
if child.gridParent:
child.gridParent.delete()
child.gridParent = None
@report(types = ['deltaStamp', 'avLocation', 'args'], dConfigParam = ['want-connector-report','want-shipboard-report'])
def startProcessVisibility(self, avatar):
if not self._onOffState:
@ -234,7 +260,7 @@ class DistributedCartesianGrid(DistributedNode, CartesianGridBase):
# zones.
# Make sure this is a valid zone
if not self.isValidZone(zoneId):
self.notify.warning("handleAvatarZoneChange: not a valid zone (%s)" % zoneId)
assert self.notify.warning("handleAvatarZoneChange: not a valid zone (%s)" % zoneId)
return
# Set the location on the server

View File

@ -292,7 +292,7 @@ class DistributedSmoothNode(DistributedNode.DistributedNode,
self.lastSuggestResync = realTime
timestampB = globalClockDelta.localToNetworkTime(realTime)
serverTime = realTime - globalClockDelta.getDelta()
self.notify.info(
assert self.notify.info(
"Suggesting resync for %s, with discrepency %s; local time is %s and server time is %s." % (
self.doId, howFarFuture - chug,
realTime, serverTime))
@ -364,12 +364,12 @@ class DistributedSmoothNode(DistributedNode.DistributedNode,
globalClockDelta.getUncertainty() != None:
other = self.cr.doId2do.get(avId)
if (not other):
self.notify.info(
assert self.notify.info(
"Warning: couldn't find the avatar %d" % (avId))
elif hasattr(other, "d_returnResync"):
realTime = globalClock.getRealTime()
serverTime = realTime - globalClockDelta.getDelta()
self.notify.info(
assert self.notify.info(
"Returning resync for %s; local time is %s and server time is %s." % (
self.doId, realTime, serverTime))
other.d_returnResync(

View File

@ -259,7 +259,7 @@ class DoInterestManager(DirectObject.DirectObject):
# we're not pending a removal, but we have outstanding events?
# probably we are waiting for an add/alter complete.
# should we send those events now?
self.notify.warning('removeInterest: abandoning events: %s' %
assert self.notify.warning('removeInterest: abandoning events: %s' %
intState.events)
intState.clearEvents()
intState.state = InterestState.StatePendingDel

View File

@ -505,7 +505,7 @@ class TaskManager:
def doMethodLater(self, delayTime, funcOrTask, name, extraArgs=None,
priority=0, uponDeath=None, appendTask=False, owner = None):
if delayTime < 0:
self.notify.warning('doMethodLater: added task: %s with negative delay: %s' % (name, delayTime))
assert self.notify.warning('doMethodLater: added task: %s with negative delay: %s' % (name, delayTime))
if isinstance(funcOrTask, Task):
task = funcOrTask
elif callable(funcOrTask):
@ -747,7 +747,7 @@ class TaskManager:
# warn if the task took too long
if self.warnTaskDuration:
if dt >= self.taskDurationWarningThreshold:
TaskManager.notify.warning('task %s ran for %.2f seconds' % (
assert TaskManager.notify.warning('task %s ran for %.2f seconds' % (
task.name, dt))
return ret