diff options
author | Johannes Schickel | 2009-06-01 23:29:05 +0000 |
---|---|---|
committer | Johannes Schickel | 2009-06-01 23:29:05 +0000 |
commit | 6fcccb3fcdd8624c2bf3a7f1cecdad47c9dfbca3 (patch) | |
tree | 4546573b6b1cdc588af3e46a91a70d7dde3e8ef3 | |
parent | 6782d3efac9dd69cc33f245472b670adc39ce04e (diff) | |
download | scummvm-rg350-6fcccb3fcdd8624c2bf3a7f1cecdad47c9dfbca3.tar.gz scummvm-rg350-6fcccb3fcdd8624c2bf3a7f1cecdad47c9dfbca3.tar.bz2 scummvm-rg350-6fcccb3fcdd8624c2bf3a7f1cecdad47c9dfbca3.zip |
Slight cleanup in LoLEngine's delay and delayUntil.
svn-id: r41115
-rw-r--r-- | engines/kyra/lol.cpp | 19 |
1 files 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<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; } |