From f60e8ff53e42efa564cdee5f5bc0e3d660e4b11b Mon Sep 17 00:00:00 2001 From: Max Horn Date: Tue, 15 Jul 2003 19:20:40 +0000 Subject: [PATCH] fix for bug #771803 svn-id: r9043 --- scumm/boxes.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/scumm/boxes.cpp b/scumm/boxes.cpp index 212fcaa965d..6dba4bd8276 100644 --- a/scumm/boxes.cpp +++ b/scumm/boxes.cpp @@ -238,9 +238,15 @@ Box *Scumm::getBoxBaseAddr(int box) { // this also seems to be incorrect for atari st demo of zak // and assumingly other v2 games // The same happens in Indy3EGA (see bug #770351) - if (_gameId == GID_MONKEY_EGA || _gameId == GID_INDY3) { - if (box < 0 || box > ptr[0] - 1) - warning("Illegal box %d", box); + // Also happend in ZakEGA (see bug #771803). + // + // This *might* mean that we have a bug in our box implementation + // OTOH, the original engine, unlike ScummVM, performed no bound + // checking at all. All the problems so far have been cases where + // the value was exactly one more than what we consider the maximum. + // So it's very well possible that all of these are script errors. + if (_gameId == GID_MONKEY_EGA || _gameId == GID_INDY3 || _gameId == GID_ZAK) { + checkRange(ptr[0], 0, box, "Illegal box %d"); } else checkRange(ptr[0] - 1, 0, box, "Illegal box %d");