diff options
| author | Paul Gilbert | 2018-11-09 22:19:33 -0800 | 
|---|---|---|
| committer | Paul Gilbert | 2018-12-08 19:05:59 -0800 | 
| commit | fbed3ed7a3ab37cedf05d551e9c904db44a35b88 (patch) | |
| tree | b96501827921ce11851c0ec9716d7a928b0ea72b | |
| parent | a698756c24c50059b84b6ca8833530b5f8cfef59 (diff) | |
| download | scummvm-rg350-fbed3ed7a3ab37cedf05d551e9c904db44a35b88.tar.gz scummvm-rg350-fbed3ed7a3ab37cedf05d551e9c904db44a35b88.tar.bz2 scummvm-rg350-fbed3ed7a3ab37cedf05d551e9c904db44a35b88.zip | |
GLK: SCOTT: Handle negative values in readInts
| -rw-r--r-- | engines/gargoyle/scott/scott.cpp | 7 | 
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); | 
