aboutsummaryrefslogtreecommitdiff
path: root/engines/kyra/timer.h
diff options
context:
space:
mode:
authorJohannes Schickel2008-05-10 19:20:38 +0000
committerJohannes Schickel2008-05-10 19:20:38 +0000
commit7c7e9b831fc8b250942170bc12cd9c54602ded48 (patch)
treed5f7eb71f396a921f4f72a1473c051afaa7b7a64 /engines/kyra/timer.h
parentf930fff0d12c55e63140f45f4aee2c933f59aa63 (diff)
downloadscummvm-rg350-7c7e9b831fc8b250942170bc12cd9c54602ded48.tar.gz
scummvm-rg350-7c7e9b831fc8b250942170bc12cd9c54602ded48.tar.bz2
scummvm-rg350-7c7e9b831fc8b250942170bc12cd9c54602ded48.zip
Implemented pausing of timers, this should fix some minor glitches.
svn-id: r31985
Diffstat (limited to 'engines/kyra/timer.h')
-rw-r--r--engines/kyra/timer.h15
1 files changed, 14 insertions, 1 deletions
diff --git a/engines/kyra/timer.h b/engines/kyra/timer.h
index 0991f0a1b1..f668a88015 100644
--- a/engines/kyra/timer.h
+++ b/engines/kyra/timer.h
@@ -49,9 +49,11 @@ struct TimerEntry {
class TimerManager {
public:
- TimerManager(KyraEngine *vm, OSystem *sys) : _vm(vm), _system(sys), _timers(), _nextRun(0) {}
+ TimerManager(KyraEngine *vm, OSystem *sys) : _vm(vm), _system(sys), _timers(), _nextRun(0), _isPaused(0), _pauseStart(0) {}
~TimerManager() { reset(); }
+ void pause(bool pause);
+
void reset();
void addTimer(uint8 id, TimerFunc *func, int countdown, bool enabled);
@@ -82,10 +84,21 @@ private:
Common::List<TimerEntry> _timers;
uint32 _nextRun;
+ uint _isPaused;
+ uint32 _pauseStart;
+
typedef Common::List<TimerEntry>::iterator Iterator;
typedef Common::List<TimerEntry>::const_iterator CIterator;
};
+class PauseTimer {
+public:
+ PauseTimer(TimerManager &timer) : _timer(timer) { _timer.pause(true); }
+ ~PauseTimer() { _timer.pause(false); }
+private:
+ TimerManager &_timer;
+};
+
} // end of namespace Kyra
#endif