diff options
author | rachytski <siarhei.rachytski@gmail.com> | 2012-08-20 13:40:32 +0400 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 01:42:12 +0300 |
commit | 378ba050eeb2ec9e761c3409d2c962932508c60e (patch) | |
tree | 3a85798e5fc31ff90326b79b3187b1e33453dfad /anim | |
parent | 80d3874ed0add377a93e5d6334a1fce11f6a6a2e (diff) |
refactored anim::Task and anim::Controller to distinguish between normal Task ending and cancellation.
Diffstat (limited to 'anim')
-rw-r--r-- | anim/controller.cpp | 14 | ||||
-rw-r--r-- | anim/task.hpp | 13 |
2 files changed, 19 insertions, 8 deletions
diff --git a/anim/controller.cpp b/anim/controller.cpp index a68955d216..3e347cd4d8 100644 --- a/anim/controller.cpp +++ b/anim/controller.cpp @@ -60,14 +60,20 @@ namespace anim for (TTasks::const_iterator it = m_tasksList.begin(); it != m_tasksList.end(); ++it) { shared_ptr<Task> const & task = *it; - if (task->State() == Task::EWaitStart) + if (task->State() == Task::EStarted) task->OnStart(ts); if (task->State() == Task::EInProgress) task->OnStep(ts); - if (task->State() == Task::EWaitEnd) - task->OnEnd(ts); - else + + if (task->State() == Task::EInProgress) l.push_back(task); + else + { + if (task->State() == Task::ECancelled) + task->OnCancel(ts); + if (task->State() == Task::EEnded) + task->OnEnd(ts); + } } m_tasks.ProcessList(bind(&Controller::CopyTasks, this, ref(l), _1)); diff --git a/anim/task.hpp b/anim/task.hpp index 3853b27fce..538481ae15 100644 --- a/anim/task.hpp +++ b/anim/task.hpp @@ -9,9 +9,10 @@ namespace anim enum EState { - EWaitStart, + EStarted, EInProgress, - EWaitEnd + ECancelled, + EEnded }; private: @@ -32,8 +33,12 @@ namespace anim virtual void OnStart(double ts); virtual void OnStep(double ts); virtual void OnEnd(double ts); + virtual void OnCancel(double ts); - void Finish(); - bool IsFinished() const; + void Cancel(); + void End(); + + bool IsCancelled() const; + bool IsEnded() const; }; } |