alter interest work, and parent id fix

This commit is contained in:
Joe Shochet 2005-01-21 20:22:47 +00:00
parent b63f81f92e
commit 9538bc5a39
2 changed files with 12 additions and 24 deletions

View File

@ -713,9 +713,9 @@ class ClientRepository(ConnectionRepository.ConnectionRepository):
datagram.addUint16(CLIENT_SET_ZONE)
# Add Parent
if parent is not None:
datagram.addUint32(zoneId)
datagram.addUint32(parent)
else:
datagram.addUint32(base.localAvatar.defaultShard)
datagram.addUint32(base.localAvatar.defaultShard)
# Add zone id
datagram.addUint32(zoneId)
# if we have an explicit list of visible zones, add them
@ -814,17 +814,21 @@ class ClientRepository(ConnectionRepository.ConnectionRepository):
assert self.printInterests()
return answer
def alterInterest(self, contextId, parentId, zoneId, description):
def alterInterest(self, contextId, parentId, zoneId, description = None):
"""
Part of the new otp-server code.
Removes old and adds new..
"""
print 'new'
answer = 0
if self._interests.has_key(contextId):
self._interests[contextId] = description
self._sendAlterInterest(contextId, parentId, zoneId)
if description is not None:
self._interests[contextId] = description
self._sendAddInterest(contextId, parentId, zoneId)
answer = 1
assert self.printInterests()
assert self.printInterests()
else:
self.notify.warning("alterInterest: contextId not found: %s" % (contextId))
return answer
if __debug__:
@ -855,23 +859,6 @@ class ClientRepository(ConnectionRepository.ConnectionRepository):
datagram.addUint32(zoneId)
self.send(datagram)
def _sendAlterInterest(self, contextId, parentId, zoneId):
"""
Part of the new otp-server code.
contextId is a client-side created number that refers to
a set of interests. The same contextId number doesn't
necessarily have any relationship to the same contextId
on another client.
"""
datagram = PyDatagram()
# Add message type
datagram.addUint16(CLIENT_ALTER_INTEREST)
datagram.addUint16(contextId)
datagram.addUint32(parentId)
datagram.addUint32(zoneId)
self.send(datagram)
def _sendRemoveInterest(self, contextId):
"""
Part of the new otp-server code.

View File

@ -81,7 +81,8 @@ CLIENT_GET_PET_DETAILS_RESP = 82
# (Proposed new message): CLIENT_SET_WORLD_POS = 83
if wantOtpServer:
CLIENT_ADD_INTEREST = 97
CLIENT_ALTER_INTEREST = 98
# This is no longer supported. Alter just calls ADD_INTEREST
# CLIENT_ALTER_INTEREST = 98
CLIENT_REMOVE_INTEREST = 99
CLIENT_OBJECT_LOCATION = 102