diff options
author | Willem Jan Palenstijn | 2011-11-15 22:30:31 +0100 |
---|---|---|
committer | Willem Jan Palenstijn | 2011-11-15 23:23:24 +0100 |
commit | 689cd3edef03afa5600f85c994b19665ecbffa38 (patch) | |
tree | 2b3ff3d058ba6d3525706cbba6da1af0557ba22e /engines/dreamweb | |
parent | 01a557702a0fdfc90cf00736c7c95f8666867997 (diff) | |
download | scummvm-rg350-689cd3edef03afa5600f85c994b19665ecbffa38.tar.gz scummvm-rg350-689cd3edef03afa5600f85c994b19665ecbffa38.tar.bz2 scummvm-rg350-689cd3edef03afa5600f85c994b19665ecbffa38.zip |
DREAMWEB: Clean up a few loop structures
Diffstat (limited to 'engines/dreamweb')
-rw-r--r-- | engines/dreamweb/stubs.cpp | 31 |
1 files changed, 11 insertions, 20 deletions
diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index 6ddd01bc40..92273857fd 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -669,7 +669,7 @@ void DreamGenContext::eraseoldobs() { return; Sprite *sprites = spritetable(); - for (size_t i=0; i < 16; ++i) { + for (size_t i = 0; i < 16; ++i) { Sprite &sprite = sprites[i]; if (sprite.objData() != 0xffff) { memset(&sprite, 0xff, sizeof(Sprite)); @@ -917,11 +917,7 @@ void DreamGenContext::dealwithspecial(uint8 firstParam, uint8 secondParam) { void DreamGenContext::plotreel() { Reel *reel = getreelstart(); - while (true) { - if (reel->x < 220) - break; - if (reel->x == 255) - break; + while (reel->x >= 220 && reel->x != 255) { dealwithspecial(reel->x, reel->y); ++data.word(kReelpointer); reel += 8; @@ -1144,29 +1140,24 @@ void DreamGenContext::findormake() { void DreamGenContext::findormake(uint8 index, uint8 value, uint8 type) { Change *change = (Change *)segRef(data.word(kBuffers)).ptr(kListofchanges, sizeof(Change)); - while (true) { - if (change->index == 0xff) { - change->index = index; - change->location = data.byte(kReallocation); + for (; change->index != 0xff; ++change) { + if (index == change->index && data.byte(kReallocation) == change->location && type == change->type) { change->value = value; - change->type = type; return; } - if ((index == change->index) && (data.byte(kReallocation) == change->location) && (type == change->type)) { - change->value = value; - return; - } - ++change; } + + change->index = index; + change->location = data.byte(kReallocation); + change->value = value; + change->type = type; } void DreamGenContext::setallchanges() { Change *change = (Change *)segRef(data.word(kBuffers)).ptr(kListofchanges, sizeof(Change)); - while (change->index != 0xff) { + for (; change->index != 0xff; ++change) if (change->location == data.byte(kReallocation)) dochange(change->index, change->value, change->type); - ++change; - } } DynObject *DreamGenContext::getfreead(uint8 index) { @@ -1301,7 +1292,7 @@ void DreamGenContext::getflagunderp(uint8 *flag, uint8 *flagEx) { } void DreamGenContext::walkandexamine() { - if (! finishedwalkingCPP()) + if (!finishedwalkingCPP()) return; data.byte(kCommandtype) = data.byte(kWalkexamtype); data.byte(kCommand) = data.byte(kWalkexamnum); |