Browse Source

enforce method calldowns

Darren Ranalli 19 years ago
parent
commit
e8adeefe24
1 changed files with 10 additions and 1 deletions
  1. 10 1
      direct/src/distributed/DistributedObjectAI.py

+ 10 - 1
direct/src/distributed/DistributedObjectAI.py

@@ -3,11 +3,12 @@
 from direct.directnotify.DirectNotifyGlobal import directNotify
 from direct.directnotify.DirectNotifyGlobal import directNotify
 from direct.distributed.DistributedObjectBase import DistributedObjectBase
 from direct.distributed.DistributedObjectBase import DistributedObjectBase
 from direct.showbase import PythonUtil
 from direct.showbase import PythonUtil
+from direct.showbase.PythonUtil import EnforcesCalldowns, calldownEnforced
 from pandac.PandaModules import *
 from pandac.PandaModules import *
 #from PyDatagram import PyDatagram
 #from PyDatagram import PyDatagram
 #from PyDatagramIterator import PyDatagramIterator
 #from PyDatagramIterator import PyDatagramIterator
 
 
-class DistributedObjectAI(DistributedObjectBase):
+class DistributedObjectAI(DistributedObjectBase, EnforcesCalldowns):
     notify = directNotify.newCategory("DistributedObjectAI")
     notify = directNotify.newCategory("DistributedObjectAI")
     QuietZone = 1
     QuietZone = 1
 
 
@@ -18,6 +19,8 @@ class DistributedObjectAI(DistributedObjectBase):
             self.DistributedObjectAI_initialized = 1
             self.DistributedObjectAI_initialized = 1
             DistributedObjectBase.__init__(self, air)
             DistributedObjectBase.__init__(self, air)
 
 
+            EnforcesCalldowns.__init__(self)
+
             self.accountName=''
             self.accountName=''
             # Record the repository
             # Record the repository
             self.air = air
             self.air = air
@@ -84,6 +87,7 @@ class DistributedObjectAI(DistributedObjectBase):
         if delEvent:
         if delEvent:
             messenger.send(delEvent)
             messenger.send(delEvent)
 
 
+    @calldownEnforced
     def delete(self):
     def delete(self):
         """
         """
         Inheritors should redefine this to take appropriate action on delete
         Inheritors should redefine this to take appropriate action on delete
@@ -139,6 +143,8 @@ class DistributedObjectAI(DistributedObjectBase):
                 del self.zoneId
                 del self.zoneId
             self.__generated = False
             self.__generated = False
 
 
+            EnforcesCalldowns.EC_destroy(self)
+
     def isDeleted(self):
     def isDeleted(self):
         """
         """
         Returns true if the object has been deleted,
         Returns true if the object has been deleted,
@@ -167,6 +173,7 @@ class DistributedObjectAI(DistributedObjectBase):
         self.doId = self.air.allocateChannel()
         self.doId = self.air.allocateChannel()
         self.__preallocDoId = 1
         self.__preallocDoId = 1
 
 
+    @calldownEnforced
     def announceGenerate(self):
     def announceGenerate(self):
         """
         """
         Called after the object has been generated and all
         Called after the object has been generated and all
@@ -373,6 +380,7 @@ class DistributedObjectAI(DistributedObjectBase):
         self.generate()
         self.generate()
         self.announceGenerate()
         self.announceGenerate()
 
 
+    @calldownEnforced
     def generate(self):
     def generate(self):
         """
         """
         Inheritors should put functions that require self.zoneId or
         Inheritors should put functions that require self.zoneId or
@@ -380,6 +388,7 @@ class DistributedObjectAI(DistributedObjectBase):
         """
         """
         assert self.notify.debugStateCall(self)
         assert self.notify.debugStateCall(self)
 
 
+    @calldownEnforced
     def generateInit(self, repository=None):
     def generateInit(self, repository=None):
         """
         """
         First generate (not from cache).
         First generate (not from cache).