From dbb484fff593f232e868f97d690a49d80f91f881 Mon Sep 17 00:00:00 2001 From: Zachary Pavlov Date: Fri, 16 Feb 2007 00:51:16 +0000 Subject: [PATCH] gets rid of a race condition potentially on the ai --- direct/src/distributed/DistributedCartesianGridAI.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/direct/src/distributed/DistributedCartesianGridAI.py b/direct/src/distributed/DistributedCartesianGridAI.py index 9501f49259..03aac54492 100755 --- a/direct/src/distributed/DistributedCartesianGridAI.py +++ b/direct/src/distributed/DistributedCartesianGridAI.py @@ -92,19 +92,17 @@ class DistributedCartesianGridAI(DistributedNodeAI, CartesianGridBase): def updateGridTask(self, task=None): # Run through all grid objects and update their parents if needed missingObjs = [] - for avId in self.gridObjects: + for avId in self.gridObjects.keys(): av = self.gridObjects[avId] # handle a missing object after it is already gone? if (av.isEmpty()): - missingObjs.append(avId) + del self.gridObjects[avId] continue pos = av.getPos() if ((pos[0] < 0 or pos[1] < 0) or (pos[0] > self.cellWidth or pos[1] > self.cellWidth)): # we are out of the bounds of this current cell self.handleAvatarZoneChange(av) - for currMissingObj in missingObjs: - del self.gridObjects[avId] # Do this every second, not every frame if (task): task.delayTime = 1.0