aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorFilippos Karapetis2010-06-24 18:48:50 +0000
committerFilippos Karapetis2010-06-24 18:48:50 +0000
commit42ca630f46f0991f58592c7b2195ff41bdd73b04 (patch)
tree403c0c69f97c05c464b89541605e62ca48e69f41 /engines
parent346c3a3230cf19a3fe9b0306634864f8dfa60faa (diff)
downloadscummvm-rg350-42ca630f46f0991f58592c7b2195ff41bdd73b04.tar.gz
scummvm-rg350-42ca630f46f0991f58592c7b2195ff41bdd73b04.tar.bz2
scummvm-rg350-42ca630f46f0991f58592c7b2195ff41bdd73b04.zip
Fixed the LSL3 binoculars scene again, by fixing the invalid varselector reference
svn-id: r50227
Diffstat (limited to 'engines')
-rw-r--r--engines/sci/engine/vm.cpp22
1 files changed, 14 insertions, 8 deletions
diff --git a/engines/sci/engine/vm.cpp b/engines/sci/engine/vm.cpp
index 4c039d72a0..b7da805251 100644
--- a/engines/sci/engine/vm.cpp
+++ b/engines/sci/engine/vm.cpp
@@ -101,23 +101,29 @@ static reg_t &validate_property(Object *obj, int index) {
// A static dummy reg_t, which we return if obj or index turn out to be
// invalid. Note that we cannot just return NULL_REG, because client code
// may modify the value of the returned reg_t.
- static reg_t dummyReg = NULL_REG;
+ //static reg_t dummyReg = NULL_REG;
// FIXME/TODO: Where does this occur? Returning a dummy reg here could lead
// to all sorts of issues! Turned it into an error for now...
// If this occurs, it means there's probably something wrong with the garbage
// collector, so don't hide it with fake return values
if (!obj) {
- error("Sending to disposed object");
- return dummyReg;
+ error("validate_property: Sending to disposed object");
+ //return dummyReg;
}
- // FIXME/TODO: Where does this occur? Returning a dummy reg here could lead
- // to all sorts of issues! Turned it into an error for now...
+ // This occurs in LSL3, binoculars scene. This gets called from kDoBresen, so fix
+ // the relevant invalid selector index. TODO: Why does this occur? This looks like
+ // a script bug.
+ EngineState *s = g_sci->getEngineState();
+ if (index == 633 && s->currentRoomNumber() == 206 && g_sci->getGameId() == "lsl3")
+ index = 37;
+
if (index < 0 || (uint)index >= obj->getVarCount()) {
- error("Invalid object property #%d (out of [0..%d]) requested!",
- index, obj->getVarCount());
- return dummyReg;
+ error("Invalid object property #%d (out of [0..%d]) requested! Object: %04x:%04x, %s",
+ index, obj->getVarCount(), PRINT_REG(obj->getPos()),
+ s->_segMan->getObjectName(obj->getPos()));
+ //return dummyReg;
}
return obj->getVariableRef(index);