[Scummvm-cvs-logs] scummvm master -> 6244b6afe2e4634946ede4f971f664e7213014ed

urukgit urukgit at users.noreply.github.com
Mon Nov 18 15:51:04 CET 2013


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
6244b6afe2 AVALANCHE: Repair the timer.


Commit: 6244b6afe2e4634946ede4f971f664e7213014ed
    https://github.com/scummvm/scummvm/commit/6244b6afe2e4634946ede4f971f664e7213014ed
Author: urukgit (koppirnyo at gmail.com)
Date: 2013-11-18T06:50:42-08:00

Commit Message:
AVALANCHE: Repair the timer.

Changed paths:
    engines/avalanche/avalot.cpp
    engines/avalanche/timer.cpp
    engines/avalanche/timer.h



diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp
index 5d360d1..87b2b7a 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 8a4ee7e..93889b7 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 6cd894b..9a91c4d 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);






More information about the Scummvm-git-logs mailing list