From b4935bdcdf352eaa77fde6a90129c0f532b18871 Mon Sep 17 00:00:00 2001 From: Mike Goslin Date: Wed, 18 May 2005 01:57:38 +0000 Subject: [PATCH] Assigned default parentId in generateWithRequired. --- direct/src/distributed/DistributedObjectAI.py | 45 ++++++++++++------- 1 file changed, 29 insertions(+), 16 deletions(-) diff --git a/direct/src/distributed/DistributedObjectAI.py b/direct/src/distributed/DistributedObjectAI.py index 740c72932e..63ffb1e135 100644 --- a/direct/src/distributed/DistributedObjectAI.py +++ b/direct/src/distributed/DistributedObjectAI.py @@ -271,23 +271,36 @@ class DistributedObjectAI(DirectObject.DirectObject): if self.air: self.air.sendUpdateToChannel(self, channelId, fieldName, args) - def generateWithRequired(self, zoneId, optionalFields=[]): - assert self.notify.debugStateCall(self) - # have we already allocated a doId? - if self.__preallocDoId: - self.__preallocDoId = 0 - return self.generateWithRequiredAndId( - self.doId, zoneId, optionalFields) + if wantOtpServer: + def generateWithRequired(self, zoneId, optionalFields=[]): + assert self.notify.debugStateCall(self) + # have we already allocated a doId? + if self.__preallocDoId: + self.__preallocDoId = 0 + return self.generateWithRequiredAndId( + self.doId, zoneId, optionalFields) - # The repository is the one that really does the work - self.air.generateWithRequired(self, zoneId, optionalFields) - if wantOtpServer: - #HACK: - if not hasattr(self, 'parentId'): - parentId = self.air.districtId - self.parentId = parentId - self.zoneId = zoneId - self.generate() + # The repository is the one that really does the work + parentId = self.air.districtId + #self.parentId = parentId + self.air.generateWithRequired(self, zoneId, parentId, optionalFields) + parentId = self.air.districtId + self.parentId = parentId + self.zoneId = zoneId + self.generate() + else: + def generateWithRequired(self, zoneId, optionalFields=[]): + assert self.notify.debugStateCall(self) + # have we already allocated a doId? + if self.__preallocDoId: + self.__preallocDoId = 0 + return self.generateWithRequiredAndId( + self.doId, zoneId, optionalFields) + + # The repository is the one that really does the work + self.air.generateWithRequired(self, zoneId, optionalFields) + self.zoneId = zoneId + self.generate() # this is a special generate used for estates, or anything else that # needs to have a hard coded doId as assigned by the server