aboutsummaryrefslogtreecommitdiff
path: root/engines/gargoyle/scott
diff options
context:
space:
mode:
authorPaul Gilbert2018-11-09 22:19:33 -0800
committerPaul Gilbert2018-12-08 19:05:59 -0800
commitfbed3ed7a3ab37cedf05d551e9c904db44a35b88 (patch)
treeb96501827921ce11851c0ec9716d7a928b0ea72b /engines/gargoyle/scott
parenta698756c24c50059b84b6ca8833530b5f8cfef59 (diff)
downloadscummvm-rg350-fbed3ed7a3ab37cedf05d551e9c904db44a35b88.tar.gz
scummvm-rg350-fbed3ed7a3ab37cedf05d551e9c904db44a35b88.tar.bz2
scummvm-rg350-fbed3ed7a3ab37cedf05d551e9c904db44a35b88.zip
GLK: SCOTT: Handle negative values in readInts
Diffstat (limited to 'engines/gargoyle/scott')
-rw-r--r--engines/gargoyle/scott/scott.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/engines/gargoyle/scott/scott.cpp b/engines/gargoyle/scott/scott.cpp
index 001eff5aba..9f3a87d604 100644
--- a/engines/gargoyle/scott/scott.cpp
+++ b/engines/gargoyle/scott/scott.cpp
@@ -1243,10 +1243,17 @@ void Scott::readInts(Common::SeekableReadStream *f, size_t count, ...) {
// Get the next value
int *val = (int *)va_arg(va, int);
*val = 0;
+
+ int factor = c == '-' ? -1 : 1;
+ if (factor == -1)
+ c = f->readByte();
+
while (Common::isDigit(c)) {
*val = (*val * 10) + (c - '0');
c = f->readByte();
}
+
+ *val *= factor; // Handle negatives
}
va_end(va);