From 6fcccb3fcdd8624c2bf3a7f1cecdad47c9dfbca3 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Mon, 1 Jun 2009 23:29:05 +0000 Subject: Slight cleanup in LoLEngine's delay and delayUntil. svn-id: r41115 --- engines/kyra/lol.cpp | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/engines/kyra/lol.cpp b/engines/kyra/lol.cpp index a5e9f38ffe..d2939a9b92 100644 --- a/engines/kyra/lol.cpp +++ b/engines/kyra/lol.cpp @@ -1780,23 +1780,28 @@ uint16 *LoLEngine::getCharacterOrMonsterProtectionAgainstItems(int id) { } 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(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(del, _tickLength); _system->delayMillis(step); del -= step; } -- cgit v1.2.3