diff options
author | Max Horn | 2010-06-25 16:11:00 +0000 |
---|---|---|
committer | Max Horn | 2010-06-25 16:11:00 +0000 |
commit | 1e9977a725ca24a2d31cac56b0587bae09ab5b3a (patch) | |
tree | f9c86347be62eff5432ec36126e02e823ceeb6fd | |
parent | 7d4d58bab41249e9a29c42c0f2715ff5e1c1d6cc (diff) | |
download | scummvm-rg350-1e9977a725ca24a2d31cac56b0587bae09ab5b3a.tar.gz scummvm-rg350-1e9977a725ca24a2d31cac56b0587bae09ab5b3a.tar.bz2 scummvm-rg350-1e9977a725ca24a2d31cac56b0587bae09ab5b3a.zip |
SCI: Restrict some 'error' exceptions to the places they occur; cleanup
svn-id: r50271
-rw-r--r-- | engines/sci/engine/segment.cpp | 21 | ||||
-rw-r--r-- | engines/sci/engine/static_selectors.cpp | 6 |
2 files changed, 18 insertions, 9 deletions
diff --git a/engines/sci/engine/segment.cpp b/engines/sci/engine/segment.cpp index 28cc03d175..6a564fcc57 100644 --- a/engines/sci/engine/segment.cpp +++ b/engines/sci/engine/segment.cpp @@ -464,10 +464,16 @@ SegmentRef LocalVariables::dereference(reg_t pointer) { if (ret.maxSize > 0) { ret.reg = &_locals[pointer.offset / 2]; } else { - // Happens in two places during the intro of LB2CD, both from kMemory(peek): - // - room 160: Heap 160 has 83 local variables (0-82), and the game asks for variables at indices 83 - 90 too - // - room 220: Heap 220 has 114 local variables (0-113), and the game asks for variables at indices 114-120 too - warning("LocalVariables::dereference: Offset at end or out of bounds %04x:%04x", PRINT_REG(pointer)); + if ((g_sci->getEngineState()->currentRoomNumber() == 660 || g_sci->getEngineState()->currentRoomNumber() == 660) + && g_sci->getGameId() == "laurabow2") { + // Happens in two places during the intro of LB2CD, both from kMemory(peek): + // - room 160: Heap 160 has 83 local variables (0-82), and the game + // asks for variables at indices 83 - 90 too. + // - room 220: Heap 220 has 114 local variables (0-113), and the + // game asks for variables at indices 114-120 too. + } else { + error("LocalVariables::dereference: Offset at end or out of bounds %04x:%04x", PRINT_REG(pointer)); + } ret.reg = 0; } return ret; @@ -514,8 +520,11 @@ SegmentRef SystemStrings::dereference(reg_t pointer) { if (isValidOffset(pointer.offset)) ret.raw = (byte *)(_strings[pointer.offset]._value); else { - // This occurs in KQ5CD when interacting with certain objects - warning("SystemStrings::dereference(): Attempt to dereference invalid pointer %04x:%04x", PRINT_REG(pointer)); + if (g_sci->getGameId() == "kq5") { + // This occurs in KQ5CD when interacting with certain objects + } else { + error("SystemStrings::dereference(): Attempt to dereference invalid pointer %04x:%04x", PRINT_REG(pointer)); + } } return ret; diff --git a/engines/sci/engine/static_selectors.cpp b/engines/sci/engine/static_selectors.cpp index fcef04f6ad..12d61ed24a 100644 --- a/engines/sci/engine/static_selectors.cpp +++ b/engines/sci/engine/static_selectors.cpp @@ -150,10 +150,10 @@ Common::StringArray Kernel::checkStaticSelectorNames() { } for (const SelectorRemap *selectorRemap = sciSelectorRemap; selectorRemap->slot; ++selectorRemap) { - uint32 slot = selectorRemap->slot; - if (selectorRemap->slot >= names.size()) - names.resize(selectorRemap->slot + 1); if (getSciVersion() >= selectorRemap->minVersion && getSciVersion() <= selectorRemap->maxVersion) { + const uint32 slot = selectorRemap->slot; + if (slot >= names.size()) + names.resize(slot + 1); names[slot] = selectorRemap->name; } } |