From afffcec96ec03a0e39d692080849e2e36722637a Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Thu, 24 Jun 2010 11:29:26 +0000 Subject: Turned two hacks inside validate_property() into errors till we find out where and why they occur (they shouldn't occur). Also turned an error inside send_selector() when argc > 1 into a warning - these are usually script bugs and aren't fatal svn-id: r50208 --- engines/sci/engine/vm.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'engines') diff --git a/engines/sci/engine/vm.cpp b/engines/sci/engine/vm.cpp index de04c49ef7..53cba93f98 100644 --- a/engines/sci/engine/vm.cpp +++ b/engines/sci/engine/vm.cpp @@ -103,13 +103,19 @@ static reg_t &validate_property(Object *obj, int index) { // may modify the value of the returned reg_t. 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) { - debugC(2, kDebugLevelVM, "[VM] Sending to disposed object!"); + error("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... if (index < 0 || (uint)index >= obj->getVarCount()) { - debugC(2, kDebugLevelVM, "[VM] Invalid property #%d (out of [0..%d]) requested!", + error("Invalid object property #%d (out of [0..%d]) requested!", index, obj->getVarCount()); return dummyReg; } @@ -421,11 +427,11 @@ ExecStack *send_selector(EngineState *s, reg_t send_obj, reg_t work_obj, StackPt // QFG1VGA has a script bug in the longSong object when invoking the // loop selector, which doesn't affect gameplay, thus don't diplay it } else { - // Unknown script bug, show it + // Unknown script bug, show it. Usually these aren't fatal. reg_t oldReg = *varp.getPointer(s->_segMan); reg_t newReg = argp[1]; const char *selectorName = g_sci->getKernel()->getSelectorName(selector).c_str(); - error("send_selector(): argc = %d while modifying variable selector " + warning("send_selector(): argc = %d while modifying variable selector " "%x (%s) of object %04x:%04x (%s) from %04x:%04x to %04x:%04x", argc, selector, selectorName, PRINT_REG(send_obj), objectName, PRINT_REG(oldReg), PRINT_REG(newReg)); -- cgit v1.2.3