From fbed3ed7a3ab37cedf05d551e9c904db44a35b88 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 9 Nov 2018 22:19:33 -0800 Subject: GLK: SCOTT: Handle negative values in readInts --- engines/gargoyle/scott/scott.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'engines/gargoyle/scott/scott.cpp') 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); -- cgit v1.2.3