tweaks for intervals

This commit is contained in:
David Rose 2002-09-06 00:43:05 +00:00
parent e499b8ff2f
commit 87cd4d5901
2 changed files with 14 additions and 4 deletions

View File

@ -21,13 +21,23 @@
def pause(self): def pause(self):
self.interrupt() self.interrupt()
# Kill task # Kill old task(s), including those from a similarly-named but
taskMgr.remove(self.getName() + '-play') # different interval.
taskName = self.getName() + '-play'
oldTasks = taskMgr.getTasksNamed(taskName)
for task in oldTasks:
if hasattr(task, "interval"):
task.interval.interrupt()
taskMgr.remove(task)
return self.getT() return self.getT()
def resume(self): def resume(self):
# Spawn task # Spawn task
taskMgr.add(self.__playTask, self.getName() + '-play') import Task
taskName = self.getName() + '-play'
task = Task.Task(self.__playTask)
task.interval = self
taskMgr.add(task, taskName)
def finish(self): def finish(self):
# Nowadays, finish() will implicitly set the interval to its # Nowadays, finish() will implicitly set the interval to its

View File

@ -143,7 +143,7 @@ recompute() const {
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
INLINE void CInterval:: INLINE void CInterval::
check_stopped(const char *method_name) const { check_stopped(const char *method_name) const {
if (_state != S_initial && _state != S_final) { if (_state == S_started) {
interval_cat.warning() interval_cat.warning()
<< get_name() << "." << method_name << "() called in state " << get_name() << "." << method_name << "() called in state "
<< _state << ".\n"; << _state << ".\n";