[Scummvm-cvs-logs] scummvm master -> 27d302cdb16c9c94b1613752316a5fa09f811d63

urukgit urukgit at users.noreply.github.com
Tue Nov 19 18:26:11 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:
27d302cdb1 AVALANCHE: Fix timer.


Commit: 27d302cdb16c9c94b1613752316a5fa09f811d63
    https://github.com/scummvm/scummvm/commit/27d302cdb16c9c94b1613752316a5fa09f811d63
Author: urukgit (koppirnyo at gmail.com)
Date: 2013-11-19T09:25:51-08:00

Commit Message:
AVALANCHE: Fix timer.

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



diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp
index beb6333..8b3efe4 100644
--- a/engines/avalanche/avalanche.cpp
+++ b/engines/avalanche/avalanche.cpp
@@ -163,7 +163,6 @@ void AvalancheEngine::initVariables() {
 	_takenMushroom = false;
 	_givenPenToAyles = false;
 	_askedDogfoodAboutNim = false;
-	_ableToAddTimer = false;
 	_spludwickAtHome = false;
 	_passedCwytalotInHerts = false;
 	_lastRoom = _lastRoomNotMap = kRoomDummy;
@@ -448,7 +447,7 @@ bool AvalancheEngine::loadGame(const int16 slot) {
 	delete f;
 
 	_isLoaded = true;
-	_ableToAddTimer = false;
+
 	_seeScroll = true;  // This prevents display of the new sprites before the new picture is loaded.
 
 	if (_holdTheDawn) {
diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h
index 2734155..fdbc4c7 100644
--- a/engines/avalanche/avalanche.h
+++ b/engines/avalanche/avalanche.h
@@ -264,10 +264,7 @@ public:
 	bool _doingSpriteRun; // Only set to True if we're doing a sprite_run at this moment. This stops the trippancy system from moving any of the sprites.
 	bool _soundFx;
 
-	// These two have very similar purpose, but it's crucial not to modify _isLoaded later than the actual loading
-	// or at the begginning of the game, and _ablteToAddTimer must be modified in addTimer().
 	bool _isLoaded; // Is it a loaded gamestate?
-	bool _ableToAddTimer;
 
 	void callVerb(VerbCode id);
 	void loadRoom(byte num);
diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp
index 87b2b7a..7c9699d 100644
--- a/engines/avalanche/avalot.cpp
+++ b/engines/avalanche/avalot.cpp
@@ -1531,7 +1531,6 @@ void AvalancheEngine::newGame() {
 	_doingSpriteRun = false;
 	_avvyInBed = true;
 
-	_ableToAddTimer = true; // Set to false in _vm->loadGame().
 	_isLoaded = false;
 
 	enterRoom(kRoomYours, 1);
diff --git a/engines/avalanche/timer.cpp b/engines/avalanche/timer.cpp
index 93889b7..8a4aa1c 100644
--- a/engines/avalanche/timer.cpp
+++ b/engines/avalanche/timer.cpp
@@ -43,22 +43,20 @@ Timer::Timer(AvalancheEngine *vm) {
  * @remarks	Originally called 'set_up_timer'
  */
 void Timer::addTimer(int32 duration, byte action, byte reason) {
-	if (_vm->_ableToAddTimer) {
-		byte i = 0;
-		while ((i < 7) && (_times[i]._timeLeft != 0))
-			i++;
-
-		if (i == 7)
-			return; // Oh dear... No timer left
-
-		// Everything's OK here!
-		_times[i]._timeLeft = duration;
-		_times[i]._action = action;
-		_times[i]._reason = reason;
-	} else {
-		_vm->_ableToAddTimer = true;
-		return;
+	byte i = 0;
+	while ((i < 7) && (_times[i]._timeLeft != 0)) {
+		if (_times[i]._reason == reason) // We only add a timer if it's not already in the array.
+			return;
+		i++;
 	}
+
+	if (i == 7)
+		return; // Oh dear... No timer left
+
+	// Everything's OK here!
+	_times[i]._timeLeft = duration;
+	_times[i]._action = action;
+	_times[i]._reason = reason;
 }
 
 /**






More information about the Scummvm-git-logs mailing list