aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorPaul Gilbert2009-05-15 06:36:44 +0000
committerPaul Gilbert2009-05-15 06:36:44 +0000
commit5e5098bb966505e51bcc28fd42250678c0954a14 (patch)
treeb6cb8e74c3b357de3a1b7b5b0611998a2d2fe4ef /engines
parentbee8be58e38c3adadba0a258e84473d360fc2656 (diff)
downloadscummvm-rg350-5e5098bb966505e51bcc28fd42250678c0954a14.tar.gz
scummvm-rg350-5e5098bb966505e51bcc28fd42250678c0954a14.tar.bz2
scummvm-rg350-5e5098bb966505e51bcc28fd42250678c0954a14.zip
Bugfix to prevent off-screen areas from being restored by restoreBackground
svn-id: r40593
Diffstat (limited to 'engines')
-rw-r--r--engines/cruise/backgroundIncrust.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/engines/cruise/backgroundIncrust.cpp b/engines/cruise/backgroundIncrust.cpp
index 776aa6305d..df882ca85a 100644
--- a/engines/cruise/backgroundIncrust.cpp
+++ b/engines/cruise/backgroundIncrust.cpp
@@ -78,7 +78,11 @@ void restoreBackground(backgroundIncrustStruct *pIncrust) {
for (int i = 0; i < height; i++) {
for (int j = 0; j < width; j++) {
- pBackground[(i+Y)* 320 + j + X] = pIncrust->ptr[i * width + j];
+ int xp = j + X;
+ int yp = i + Y;
+
+ if ((xp >= 0) && (yp >= 0) && (xp < 320) && (yp < 200))
+ pBackground[yp * 320 + xp] = pIncrust->ptr[i * width + j];
}
}
}