From 04fb40be2d1cc004f4f745434a93ff67694bba27 Mon Sep 17 00:00:00 2001 From: Hein-Pieter van Braam Date: Fri, 26 May 2017 11:44:37 -0500 Subject: SCI32: Fix kArrayFill The ScummVM implementation of class SciArray::fill() has a bug where it will overwrite the array[index] with the value count times, rather than fill the array starting from index count times. This patch fixes that behavior. This was noticed because the LSL7 dice game was broken, it was impossible to lose. After this patch the dice game works as expected. Closes gh-953. --- engines/sci/engine/segment.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'engines') diff --git a/engines/sci/engine/segment.h b/engines/sci/engine/segment.h index 344977c391..adc8f138be 100644 --- a/engines/sci/engine/segment.h +++ b/engines/sci/engine/segment.h @@ -740,7 +740,7 @@ public: case kArrayTypeID: { reg_t *target = (reg_t *)_data + index; while (count--) { - *target = value; + *target++ = value; } break; } @@ -749,7 +749,7 @@ public: byte *target = (byte *)_data + index; const byte fillValue = value.getOffset(); while (count--) { - *target = fillValue; + *target++ = fillValue; } break; } -- cgit v1.2.3