diff options
-rw-r--r-- | engines/pink/objects/sequences/seq_timer.cpp | 16 | ||||
-rw-r--r-- | engines/pink/objects/sequences/seq_timer.h | 3 |
2 files changed, 6 insertions, 13 deletions
diff --git a/engines/pink/objects/sequences/seq_timer.cpp b/engines/pink/objects/sequences/seq_timer.cpp index 78a5bd554a..26c8afa93a 100644 --- a/engines/pink/objects/sequences/seq_timer.cpp +++ b/engines/pink/objects/sequences/seq_timer.cpp @@ -31,9 +31,7 @@ namespace Pink { SeqTimer::SeqTimer() - : _updatesToMessage(0) { - -} + : _updatesToMessage(0) {} void SeqTimer::deserialize(Archive &archive) { archive >> _actor; @@ -47,20 +45,18 @@ void SeqTimer::toConsole() { } void SeqTimer::update() { - Common::RandomSource &random =_sequencer->_page->getGame()->getRnd(); + Common::RandomSource &rnd =_sequencer->_page->getGame()->getRnd(); if (_updatesToMessage--) return; - calculateUpdatesCount(); - SupportingActor *actor = static_cast<SupportingActor*>(_sequencer->_page->findActor(_actor)); + _updatesToMessage = _range ? _period + rnd.getRandomNumber(_range) : _period; + + SupportingActor *actor = static_cast<SupportingActor*>(_sequencer->_page->findActor(_actor)); if (actor && !_sequencer->findSequenceActorState(actor->getName())){ actor->onTimerMessage(); } } -void SeqTimer::calculateUpdatesCount() { - Common::RandomSource &random =_sequencer->_page->getGame()->getRnd(); - _updatesToMessage = _range ? _period + random.getRandomNumber(_range) : _period; -} + } // End of namespace Pink
\ No newline at end of file diff --git a/engines/pink/objects/sequences/seq_timer.h b/engines/pink/objects/sequences/seq_timer.h index 0b961c0c25..5970d2ab4c 100644 --- a/engines/pink/objects/sequences/seq_timer.h +++ b/engines/pink/objects/sequences/seq_timer.h @@ -34,12 +34,9 @@ public: SeqTimer(); virtual void deserialize(Archive &archive); virtual void toConsole(); - virtual void update(); - private: - void calculateUpdatesCount(); Common::String _actor; Sequencer *_sequencer; int _period; |