*** empty log message ***

This commit is contained in:
Roger Hughston 2005-02-11 01:57:21 +00:00
parent 1f23a24db3
commit 1d934cb314
2 changed files with 58 additions and 36 deletions

View File

@ -614,6 +614,24 @@ class ClientRepository(ConnectionRepository.ConnectionRepository):
self.handleInterestDoneMessage(di) self.handleInterestDoneMessage(di)
elif msgType == CLIENT_OBJECT_LOCATION: elif msgType == CLIENT_OBJECT_LOCATION:
self.handleObjectLocation(di) self.handleObjectLocation(di)
else:
currentLoginState = self.loginFSM.getCurrentState()
if currentLoginState:
currentLoginStateName = currentLoginState.getName()
else:
currentLoginStateName = "None"
currentGameState = self.gameFSM.getCurrentState()
if currentGameState:
currentGameStateName = currentGameState.getName()
else:
currentGameStateName = "None"
ClientRepository.notify.warning(
"Ignoring unexpected message type: " +
str(msgType) +
" login state: " +
currentLoginStateName +
" game state: " +
currentGameStateName)
else: else:
currentLoginState = self.loginFSM.getCurrentState() currentLoginState = self.loginFSM.getCurrentState()
if currentLoginState: if currentLoginState:
@ -769,10 +787,9 @@ class ClientRepository(ConnectionRepository.ConnectionRepository):
if self.notify.getDebug(): if self.notify.getDebug():
print "ClientRepository received datagram:" print "ClientRepository received datagram:"
di.getDatagram().dumpHex(ostream) di.getDatagram().dumpHex(ostream)
msgType = self.getMsgType() msgType = self.getMsgType()
if not wantOtpServer: if not wantOtpServer:
if msgType == CLIENT_DONE_SET_ZONE_RESP: if msgType == CLIENT_DONE_SET_ZONE_RESP:
self.handleSetZoneDone() self.handleSetZoneDone()

View File

@ -15,30 +15,34 @@ from direct.showbase import DirectObject
from PyDatagram import PyDatagram from PyDatagram import PyDatagram
#from PyDatagramIterator import PyDatagramIterator #from PyDatagramIterator import PyDatagramIterator
class DoInterestManager(DirectObject.DirectObject): class DoInterestManager(DirectObject.DirectObject):
""" """
Top level Interest Manager Top level Interest Manager
""" """
if __debug__: if __debug__:
notify = DirectNotifyGlobal.directNotify.newCategory("DoInterestManager") notify = DirectNotifyGlobal.directNotify.newCategory("DoInterestManager")
_interestIdAssign = 1;
_interestIdScopes = 100;
_interests = {}
def __init__(self): def __init__(self):
assert self.notify.debugCall() assert self.notify.debugCall()
DirectObject.DirectObject.__init__(self) DirectObject.DirectObject.__init__(self)
self._interestIdAssign = 1
self._interestIdScopes = 100;
self._interests = {}
def addInterest(self, parentId, zoneIdList, description, event=None): def addInterest(self, parentId, zoneIdList, description, event=None):
""" """
Look into a zone. Look into a zone.
""" """
assert self.notify.debugCall() assert self.notify.debugCall()
self._interestIdAssign += 1 DoInterestManager._interestIdAssign += 1
self._interestIdScopes += 1 DoInterestManager._interestIdScopes += 1
contextId = self._interestIdAssign contextId = DoInterestManager._interestIdAssign
scopeId = self._interestIdScopes scopeId = DoInterestManager._interestIdScopes
self._interests[contextId] = [description, scopeId, event, "Active"] DoInterestManager._interests[contextId] = [description, scopeId, event, "Active"]
self._sendAddInterest(contextId, scopeId, parentId, zoneIdList) self._sendAddInterest(contextId, scopeId, parentId, zoneIdList)
assert self.printInterests() assert self.printInterests()
return contextId return contextId
@ -49,18 +53,18 @@ class DoInterestManager(DirectObject.DirectObject):
""" """
assert self.notify.debugCall() assert self.notify.debugCall()
answer = 0 answer = 0
if self._interests.has_key(contextId): if DoInterestManager._interests.has_key(contextId):
if event is not None: if event is not None:
self._interestIdScopes += 1 DoInterestManager._interestIdScopes += 1
self._interests[contextId][3] = "PendingDel" DoInterestManager._interests[contextId][3] = "PendingDel"
self._interests[contextId][2] = event DoInterestManager._interests[contextId][2] = event
self._interests[contextId][1] = self._interestIdScopes DoInterestManager._interests[contextId][1] = DoInterestManager._interestIdScopes
self._sendRemoveInterest(contextId) self._sendRemoveInterest(contextId)
else: else:
self._interests[contextId][2] = None DoInterestManager._interests[contextId][2] = None
self._interests[contextId][1] = 0 DoInterestManager._interests[contextId][1] = 0
self._sendRemoveInterest(contextId) self._sendRemoveInterest(contextId)
del self._interests[contextId] del DoInterestManager._interests[contextId]
answer = 1 answer = 1
else: else:
self.notify.warning("removeInterest: contextId not found: %s" % (contextId)) self.notify.warning("removeInterest: contextId not found: %s" % (contextId))
@ -73,14 +77,14 @@ class DoInterestManager(DirectObject.DirectObject):
""" """
assert self.notify.debugCall() assert self.notify.debugCall()
answer = 0 answer = 0
if self._interests.has_key(contextId): if DoInterestManager._interests.has_key(contextId):
self._interestIdScopes += 1 DoInterestManager._interestIdScopes += 1
if description is not None: if description is not None:
self._interests[contextId][0] = description DoInterestManager._interests[contextId][0] = description
self._interests[contextId][1] = self._interestIdScopes; DoInterestManager._interests[contextId][1] = DoInterestManager._interestIdScopes;
self._interests[contextId][2] = event; DoInterestManager._interests[contextId][2] = event;
self._sendAddInterest(contextId, self._interestIdScopes, parentId, zoneIdList) self._sendAddInterest(contextId, DoInterestManager._interestIdScopes, parentId, zoneIdList)
answer = 1 answer = 1
assert self.printInterests() assert self.printInterests()
else: else:
@ -95,8 +99,8 @@ class DoInterestManager(DirectObject.DirectObject):
""" """
assert self.notify.debugCall() assert self.notify.debugCall()
answer = 0 answer = 0
if self._interests.has_key(contextId): if DoInterestManager._interests.has_key(contextId):
answer = self._interests[contextId][1]; answer = DoInterestManager._interests[contextId][1];
else: else:
self.notify.warning("GetInterestScopeID: contextId not found: %s" % (contextId)) self.notify.warning("GetInterestScopeID: contextId not found: %s" % (contextId))
return answer return answer
@ -108,8 +112,8 @@ class DoInterestManager(DirectObject.DirectObject):
""" """
assert self.notify.debugCall() assert self.notify.debugCall()
answer = None answer = None
if self._interests.has_key(contextId): if DoInterestManager._interests.has_key(contextId):
answer = self._interests[contextId][2]; answer = DoInterestManager._interests[contextId][2];
else: else:
self.notify.warning("GetInterestScopeEvent: contextId not found: %s" % (contextId)) self.notify.warning("GetInterestScopeEvent: contextId not found: %s" % (contextId))
return answer return answer
@ -119,9 +123,9 @@ class DoInterestManager(DirectObject.DirectObject):
Consider whether we should cull the interest set. Consider whether we should cull the interest set.
""" """
assert self.notify.debugCall() assert self.notify.debugCall()
if self._interests.has_key(handle): if DoInterestManager._interests.has_key(handle):
if self._interests[handle][3] == "PendingDel": if DoInterestManager._interests[handle][3] == "PendingDel":
del self._interests[handle] del DoInterestManager._interests[handle]
if __debug__: if __debug__:
def printInterests(self): def printInterests(self):
@ -129,13 +133,13 @@ class DoInterestManager(DirectObject.DirectObject):
Part of the new otp-server code. Part of the new otp-server code.
""" """
print "*********************** Interest Sets **************" print "*********************** Interest Sets **************"
for i in self._interests.keys(): for i in DoInterestManager._interests.keys():
print "Interest ID:%s, Description=%s Scope=%s Event=%s Mode=%s"%( print "Interest ID:%s, Description=%s Scope=%s Event=%s Mode=%s"%(
i, i,
self._interests[i][0], DoInterestManager._interests[i][0],
self._interests[i][1], DoInterestManager._interests[i][1],
self._interests[i][2], DoInterestManager._interests[i][2],
self._interests[i][3]) DoInterestManager._interests[i][3])
print "****************************************************" print "****************************************************"
return 1 # for assert() return 1 # for assert()
@ -202,3 +206,4 @@ class DoInterestManager(DirectObject.DirectObject):
print "handleInterestDoneMessage--> Scope MisMatch :%s :%s"%(expect_scope,scope); print "handleInterestDoneMessage--> Scope MisMatch :%s :%s"%(expect_scope,scope);
assert self.printInterests() assert self.printInterests()