Commit Graph

3 Commits

Author SHA1 Message Date
Naios
3d95aba2b3 Core/Utilities: TaskScheduler: add a task validator and on update success callback.
* makes it possible to block tasks if there is an active spellcast.
* requested by @joschiwald
2015-06-21 18:19:17 +02:00
Naios
151a0f5c5e Core/Shared: Hide the internal shared_ptr of the TaskContext
* use . operator instead of -> to access the TaskContext now.
* Add TaskContext::IsExpired to check whether the owner has expired.
2015-06-03 18:24:21 +02:00
Naios
da77a90aa9 Shared/Util: Introduce a task scheduler which schedules task with c++11 techniques.
* Use std::function as callback (methods, lamdas & std::bind).
* Uses std::chrono::duration as duration type (Milliseconds, Seconds...)
  - With c++11 user defined literals we could just write "11s" for example (MSVS 2015, gcc & clang).
* Provides a lot of overloads for easier usage:
  - Static durations or random durations between min and max.
  - Named (with group ids - group id 0 is possible) or anonymous tasks.
  - Asynchronous tasks.
* Is adapted to the current needs of scripting:
  - Repeat tasks through the TaskContext
  - Schedule new tasks from the context.
  - Provides access to the times repeat counter of a task,
    this will help to schedule multi step events (dialogs for example).

See https://gist.github.com/Naios/6d143538abdc3d32fd2b for usage examples.
2015-05-31 19:32:09 +02:00