Browse Source

changed location back to __location and added setInitLocation

Samir Naik 20 years ago
parent
commit
bffab12c27

+ 5 - 5
direct/src/distributed/DistributedObject.py

@@ -37,7 +37,7 @@ class DistributedObject(PandaObject):
             self.cr = cr
             self.cr = cr
             if wantOtpServer:
             if wantOtpServer:
                 # Location stores the parentId, zoneId of this object
                 # Location stores the parentId, zoneId of this object
-                self.location = (None, None)
+                self.__location = (None, None)
 
 
             # Most DistributedObjects are simple and require no real
             # Most DistributedObjects are simple and require no real
             # effort to load.  Some, particularly actors, may take
             # effort to load.  Some, particularly actors, may take
@@ -156,8 +156,8 @@ class DistributedObject(PandaObject):
             self.activeState = ESDisabled
             self.activeState = ESDisabled
             self.__callbacks = {}
             self.__callbacks = {}
             if wantOtpServer:
             if wantOtpServer:
-                #self.cr.deleteObjectLocation(self.doId, self.location[0], self.location[1])
-                self.location = (None, None)
+                #self.cr.deleteObjectLocation(self.doId, self.__location[0], self.__location[1])
+                self.__location = (None, None)
                 # TODO: disable my children
                 # TODO: disable my children
 
 
     def isDisabled(self):
     def isDisabled(self):
@@ -352,7 +352,7 @@ class DistributedObject(PandaObject):
             #self.notify.info("setLocation: %s parentId: %s zoneId: %s" % (self.doId, parentId, zoneId))
             #self.notify.info("setLocation: %s parentId: %s zoneId: %s" % (self.doId, parentId, zoneId))
             # The store must run first so we know the old location
             # The store must run first so we know the old location
             #self.cr.storeObjectLocation(self.doId, parentId, zoneId)
             #self.cr.storeObjectLocation(self.doId, parentId, zoneId)
-            self.location = (parentId, zoneId)
+            self.__location = (parentId, zoneId)
             self.parentId = parentId
             self.parentId = parentId
             self.zoneId = zoneId
             self.zoneId = zoneId
 
 
@@ -364,7 +364,7 @@ class DistributedObject(PandaObject):
                 parentObj.handleChildSetLocation(self, zoneId)
                 parentObj.handleChildSetLocation(self, zoneId)
             
             
         def getLocation(self):
         def getLocation(self):
-            return self.location
+            return self.__location
 
 
         def handleChildSetLocation(self, childObj, zoneId):
         def handleChildSetLocation(self, childObj, zoneId):
             self.notify.info("handleChildSetLocation: %s childId: %s zoneId: %s" %
             self.notify.info("handleChildSetLocation: %s childId: %s zoneId: %s" %

+ 8 - 4
direct/src/distributed/DistributedObjectAI.py

@@ -21,7 +21,7 @@ class DistributedObjectAI(DirectObject.DirectObject):
             # Record the repository
             # Record the repository
             self.air = air
             self.air = air
             # Record our parentId and zoneId
             # Record our parentId and zoneId
-            self.location = None
+            self.__location = None
 
 
             # Record our distributed class
             # Record our distributed class
             className = self.__class__.__name__
             className = self.__class__.__name__
@@ -167,10 +167,14 @@ class DistributedObjectAI(DirectObject.DirectObject):
                     self.handleLogicalZoneChange(zoneId, lastLogicalZone)
                     self.handleLogicalZoneChange(zoneId, lastLogicalZone)
                     self.lastNonQuietZone = zoneId
                     self.lastNonQuietZone = zoneId
                 #self.air.storeObjectLocation(self.doId, parentId, zoneId)
                 #self.air.storeObjectLocation(self.doId, parentId, zoneId)
-                self.location = (parentId, zoneId)
+                self.__location = (parentId, zoneId)
 
 
+        # Set the initial values of parentId,zoneId
+        def setInitLocation(self, parentId, zoneId):
+            self.__location = (parentId, zoneId)
+            
         def getLocation(self):
         def getLocation(self):
-            return self.location
+            return self.__location
 
 
     else:
     else:
         # NON OTP
         # NON OTP
@@ -342,7 +346,7 @@ class DistributedObjectAI(DirectObject.DirectObject):
             assert not hasattr(self, 'parentId')
             assert not hasattr(self, 'parentId')
             self.parentId = parentId
             self.parentId = parentId
             self.zoneId = zoneId
             self.zoneId = zoneId
-            self.location = (parentId, zoneId)
+            self.__location = (parentId, zoneId)
             self.generate()
             self.generate()
 
 
     def generate(self):
     def generate(self):