[Scummvm-cvs-logs] CVS: scummvm/common timer.cpp,1.20,1.21

Max Horn fingolfin at users.sourceforge.net
Fri Oct 17 04:23:07 CEST 2003


Update of /cvsroot/scummvm/scummvm/common
In directory sc8-pr-cvs1:/tmp/cvs-serv4293

Modified Files:
	timer.cpp 
Log Message:
fix (workaround) for bug #825331

Index: timer.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/common/timer.cpp,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- timer.cpp	17 Oct 2003 11:11:01 -0000	1.20
+++ timer.cpp	17 Oct 2003 11:17:49 -0000	1.21
@@ -89,10 +89,14 @@
 	interval = 1000 * (_thisTime - _lastTime);
 
 	for (l = 0; l < MAX_TIMERS; l++) {
-		if ((_timerSlots[l].procedure) && (_timerSlots[l].interval > 0)) {
+		if (_timerSlots[l].procedure && _timerSlots[l].interval > 0) {
 			_timerSlots[l].counter -= interval;
-			while (_timerSlots[l].counter <= 0) {
-				assert(_timerSlots[l].interval > 0);
+			// FIXME: We only check the value of _timerSlots[l].interval here
+			// because the timer might remove itself.
+			// Strictly spoken, that is a dirty thing to do for a timer, but for
+			// now the bundle timer requires this. Of course the whole bundle
+			// music timer is kind of scary anyway...
+			while (_timerSlots[l].counter <= 0 && _timerSlots[l].interval > 0) {
 				_timerSlots[l].counter += _timerSlots[l].interval;
 				_timerSlots[l].procedure(_timerSlots[l].refCon);
 			}
@@ -108,10 +112,10 @@
 
 	for (int l = 0; l < MAX_TIMERS; l++) {
 		if (!_timerSlots[l].procedure) {
+			_timerSlots[l].procedure = procedure;
 			_timerSlots[l].interval = interval;
 			_timerSlots[l].counter = interval;
 			_timerSlots[l].refCon = refCon;
-			_timerSlots[l].procedure = procedure;
 			return true;
 		}
 	}





More information about the Scummvm-git-logs mailing list