[Scummvm-cvs-logs] SF.net SVN: scummvm:[41115] scummvm/trunk/engines/kyra/lol.cpp

lordhoto at users.sourceforge.net lordhoto at users.sourceforge.net
Tue Jun 2 01:29:05 CEST 2009


Revision: 41115
          http://scummvm.svn.sourceforge.net/scummvm/?rev=41115&view=rev
Author:   lordhoto
Date:     2009-06-01 23:29:05 +0000 (Mon, 01 Jun 2009)

Log Message:
-----------
Slight cleanup in LoLEngine's delay and delayUntil.

Modified Paths:
--------------
    scummvm/trunk/engines/kyra/lol.cpp

Modified: scummvm/trunk/engines/kyra/lol.cpp
===================================================================
--- scummvm/trunk/engines/kyra/lol.cpp	2009-06-01 23:25:10 UTC (rev 41114)
+++ scummvm/trunk/engines/kyra/lol.cpp	2009-06-01 23:29:05 UTC (rev 41115)
@@ -1780,23 +1780,28 @@
 }
 
 void LoLEngine::delay(uint32 millis, bool doUpdate, bool) {
-	int del = (int)(millis);
-	while (del > 0 && !shouldQuit()) {
+	while (millis && !shouldQuit()) {
 		if (doUpdate)
 			update();
 		else
 			updateInput();
-		int step = del >= _tickLength ? _tickLength : del;
+
+		uint32 step = MIN<uint32>(millis, _tickLength);
 		_system->delayMillis(step);
-		del -= step;
+		millis -= step;
 	}
 }
 
 void LoLEngine::delayUntil(uint32 timeStamp) {
-	int del = (int)(timeStamp - _system->getMillis());
-	while (del > 0) {
+	const uint32 curTime = _system->getMillis();
+	if (curTime < timeStamp)
+		return;
+
+	uint32 del = timeStamp - curTime;
+	while (del) {
 		updateInput();
-		int step = del >= _tickLength ? _tickLength : del;
+
+		uint32 step = MIN<uint32>(del, _tickLength);
 		_system->delayMillis(step);
 		del -= step;
 	}


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list