diff options
Diffstat (limited to 'scumm')
-rw-r--r-- | scumm/script_v7he.cpp | 44 |
1 files changed, 16 insertions, 28 deletions
diff --git a/scumm/script_v7he.cpp b/scumm/script_v7he.cpp index ac14ae37c0..6e4654b6e3 100644 --- a/scumm/script_v7he.cpp +++ b/scumm/script_v7he.cpp @@ -888,44 +888,32 @@ void ScummEngine_v70he::o70_concatString() { } void ScummEngine_v70he::o70_compareString() { - byte *addr, *addr2; - int i = 0; - - int id = pop(); - int id2 = pop(); - - addr = getStringAddress(id); - if (!addr) - error("o70_compareString: Reference to zeroed array pointer (%d)", id); + int result; - addr2 = getStringAddress(id2); - if (!addr2) - error("o70_compareString: Reference to zeroed array pointer (%d)", id); + int array1 = pop(); + int array2 = pop(); - while(1) { - if (*addr != *addr2) - break; - if (*addr2 == 0) { - push(0); - return; - } + byte *string1 = getStringAddress(array1); + if (!string1) + error("o70_compareString: Reference to zeroed array pointer (%d)", array1); - addr++; - addr2++; + byte *string2 = getStringAddress(array2); + if (!string2) + error("o70_compareString: Reference to zeroed array pointer (%d)", array2); - if (*addr != *addr2) - break; - if (*addr2 == 0) { + while (*string1 == *string2) { + if (*string2 == 0) { push(0); return; } - addr++; - addr2++; + string1++; + string2++; } - push (i); - debug(1,"o70_compareString (%d, %d, %d)", id, id2, i); + result = (*string1 > *string2) ? -1 : 1; + push(result); + debug(1,"o70_compareString (%d, %d, %d)", array1, array2, result); } void ScummEngine_v70he::o70_readINI() { |