diff options
Diffstat (limited to 'engines/avalanche')
-rw-r--r-- | engines/avalanche/avalot.cpp | 1 | ||||
-rw-r--r-- | engines/avalanche/timer.cpp | 20 | ||||
-rw-r--r-- | engines/avalanche/timer.h | 2 |
3 files changed, 13 insertions, 10 deletions
diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 5d360d1c3f..87b2b7aef0 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -1486,6 +1486,7 @@ void AvalancheEngine::resetVariables() { _sequence->resetVariables(); _background->resetVariables(); _menu->resetVariables(); + _timer->resetVariables(); } void AvalancheEngine::newGame() { diff --git a/engines/avalanche/timer.cpp b/engines/avalanche/timer.cpp index 8a4ee7ed22..93889b76b7 100644 --- a/engines/avalanche/timer.cpp +++ b/engines/avalanche/timer.cpp @@ -35,12 +35,7 @@ namespace Avalanche { Timer::Timer(AvalancheEngine *vm) { _vm = vm; - for (int i = 0; i < 7; i++) { - _times[i]._timeLeft = 0; - _times[i]._action = 0; - _times[i]._reason = 0; - } - _timerLost = false; + resetVariables(); } /** @@ -48,7 +43,7 @@ Timer::Timer(AvalancheEngine *vm) { * @remarks Originally called 'set_up_timer' */ void Timer::addTimer(int32 duration, byte action, byte reason) { - if ((_vm->_ableToAddTimer == false) || (_timerLost == true)) { + if (_vm->_ableToAddTimer) { byte i = 0; while ((i < 7) && (_times[i]._timeLeft != 0)) i++; @@ -61,7 +56,7 @@ void Timer::addTimer(int32 duration, byte action, byte reason) { _times[i]._action = action; _times[i]._reason = reason; } else { - _vm->_ableToAddTimer = false; + _vm->_ableToAddTimer = true; return; } } @@ -218,7 +213,6 @@ void Timer::loseTimer(byte which) { _times[i]._timeLeft = 0; // Cancel this one! } - _timerLost = true; } void Timer::openDrawbridge() { @@ -690,4 +684,12 @@ void Timer::giveLuteToGeida() { // Moved here from Acci. _vm->_sequence->startGeidaLuteSeq(); } +void Timer::resetVariables() { + for (int i = 0; i < 7; i++) { + _times[i]._timeLeft = 0; + _times[i]._action = 0; + _times[i]._reason = 0; + } +} + } // End of namespace Avalanche. diff --git a/engines/avalanche/timer.h b/engines/avalanche/timer.h index 6cd894b0a5..9a91c4d24b 100644 --- a/engines/avalanche/timer.h +++ b/engines/avalanche/timer.h @@ -119,10 +119,10 @@ public: }; TimerType _times[7]; - bool _timerLost; // Is the timer "lost"? (Because of using loseTimer()) Timer(AvalancheEngine *vm); + void resetVariables(); void addTimer(int32 duration, byte action, byte reason); void updateTimer(); void loseTimer(byte which); |