Browse Source

Added the parent Id to set zone ..

Roger Hughston 21 years ago
parent
commit
c6c94f1c1b
1 changed files with 39 additions and 17 deletions
  1. 39 17
      direct/src/distributed/ClientRepository.py

+ 39 - 17
direct/src/distributed/ClientRepository.py

@@ -599,23 +599,45 @@ class ClientRepository(ConnectionRepository.ConnectionRepository):
         # send the message
         self.send(datagram)
 
-    def sendSetZoneMsg(self, zoneId, visibleZoneList=None):
-        datagram = PyDatagram()
-        # Add message type
-        datagram.addUint16(CLIENT_SET_ZONE)
-        # Add zone id
-        datagram.addUint32(zoneId)
-
-        # if we have an explicit list of visible zones, add them
-        if visibleZoneList is not None:
-            vzl = list(visibleZoneList)
-            vzl.sort()
-            assert PythonUtil.uniqueElements(vzl)
-            for zone in vzl:
-                datagram.addUint32(zone)
-
-        # send the message
-        self.send(datagram)
+    if wantOtpServer:
+        def sendSetZoneMsg(self, zoneId, visibleZoneList=None, parent=None):
+            datagram = PyDatagram()
+            # Add message type
+            datagram.addUint16(CLIENT_SET_ZONE)       
+            # Add Parent
+            if parent is not None:
+                datagram.addUint32(zoneId)
+            else:
+                datagram.addUint32(base.localAvatar.defaultShard)                                    
+            # Add zone id
+            datagram.addUint32(zoneId)
+            # if we have an explicit list of visible zones, add them
+            if visibleZoneList is not None:
+                vzl = list(visibleZoneList)
+                vzl.sort()
+                assert PythonUtil.uniqueElements(vzl)
+                for zone in vzl:
+                    datagram.addUint32(zone)
+            # send the message
+            self.send(datagram)        
+    else:
+        def sendSetZoneMsg(self, zoneId, visibleZoneList=None):
+            datagram = PyDatagram()
+            # Add message type
+            datagram.addUint16(CLIENT_SET_ZONE)       
+            # Add zone id
+            datagram.addUint32(zoneId)
+    
+            # if we have an explicit list of visible zones, add them
+            if visibleZoneList is not None:
+                vzl = list(visibleZoneList)
+                vzl.sort()
+                assert PythonUtil.uniqueElements(vzl)
+                for zone in vzl:
+                    datagram.addUint32(zone)
+
+            # send the message
+            self.send(datagram)
 
     def handleDatagram(self, di):
         if self.notify.getDebug():