David Rose 16 anni fa
parent
commit
c279dedce1

+ 3 - 0
direct/src/distributed/ClientRepositoryBase.py

@@ -63,6 +63,9 @@ class ClientRepositoryBase(ConnectionRepository):
         # other.
         self.relatedObjectMgr = RelatedObjectMgr.RelatedObjectMgr(self)
 
+        # This will be filled in when a TimeManager is created.
+        self.timeManager = None
+
         # Keep track of how recently we last sent a heartbeat message.
         # We want to keep these coming at heartbeatInterval seconds.
         self.heartbeatInterval = base.config.GetDouble('heartbeat-interval', 10)

+ 3 - 0
direct/src/distributed/TimeManager.py

@@ -70,6 +70,7 @@ class TimeManager(DistributedObject.DistributedObject):
 
     def announceGenerate(self):
         DistributedObject.DistributedObject.announceGenerate(self)
+        self.cr.timeManager = self
         self.synchronize("TimeManager.announceGenerate")
 
     def disable(self):
@@ -80,6 +81,8 @@ class TimeManager(DistributedObject.DistributedObject):
         self.ignore('clock_error')
         self.stopTask()
         taskMgr.remove('frameRateMonitor')
+        if self.cr.timeManager is self:
+            self.cr.timeManager = None
         DistributedObject.DistributedObject.disable(self)
 
     def delete(self):