diff options
-rw-r--r-- | engines/sci/engine/kernel.h | 10 | ||||
-rw-r--r-- | engines/sci/engine/kgraphics.cpp | 10 | ||||
-rw-r--r-- | engines/sci/engine/kscripts.cpp | 4 | ||||
-rw-r--r-- | engines/sci/engine/ksound.cpp | 2 | ||||
-rw-r--r-- | engines/sci/engine/seg_manager.h | 7 |
5 files changed, 13 insertions, 20 deletions
diff --git a/engines/sci/engine/kernel.h b/engines/sci/engine/kernel.h index 9c0160befd..60840a514c 100644 --- a/engines/sci/engine/kernel.h +++ b/engines/sci/engine/kernel.h @@ -224,16 +224,6 @@ int invoke_selector(EngineState *s, reg_t object, int selector_id, SelectorInvoc */ char *kernel_lookup_text(EngineState *s, reg_t address, int index); - -/******************** Debug functionality ********************/ -/** - * Checks whether a heap address contains an object - * @param s The current state - * @parm obj The address to check - * @return True if it is an object, false otherwise - */ -bool is_object(SegManager *segMan, reg_t obj); - /******************** Kernel function parameter macros ********************/ /* Returns the parameter value or (alt) if not enough parameters were supplied */ diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp index 3b17823f44..9439be3f04 100644 --- a/engines/sci/engine/kgraphics.cpp +++ b/engines/sci/engine/kgraphics.cpp @@ -805,7 +805,7 @@ reg_t kCanBeHere(EngineState *s, int, int argc, reg_t *argv) { while (widget) { if (widget->_ID && (widget->signal & _K_VIEW_SIG_FLAG_STOPUPD) && ((widget->_ID != obj.segment) || (widget->_subID != obj.offset)) - && is_object(s->segMan, make_reg(widget->_ID, widget->_subID))) + && s->segMan->isObject(make_reg(widget->_ID, widget->_subID))) if (collides_with(s, abs_zone, make_reg(widget->_ID, widget->_subID), 1, GASEOUS_VIEW_MASK_ACTIVE, argc, argv)) return not_register(s, NULL_REG); @@ -831,7 +831,7 @@ reg_t kCanBeHere(EngineState *s, int, int argc, reg_t *argv) { reg_t other_obj = node->value; debugC(2, kDebugLevelBresen, " comparing against %04x:%04x\n", PRINT_REG(other_obj)); - if (!is_object(s->segMan, other_obj)) { + if (!s->segMan->isObject(other_obj)) { warning("CanBeHere() cliplist contains non-object %04x:%04x", PRINT_REG(other_obj)); } else if (other_obj != obj) { // Clipping against yourself is not recommended @@ -1674,7 +1674,7 @@ static void draw_rect_to_control_map(EngineState *s, Common::Rect abs_zone) { static void draw_obj_to_control_map(EngineState *s, GfxDynView *view) { reg_t obj = make_reg(view->_ID, view->_subID); - if (!is_object(s->segMan, obj)) + if (!s->segMan->isObject(obj)) warning("View %d does not contain valid object reference %04x:%04x", view->_ID, PRINT_REG(obj)); reg_t* sp = view->signalp.getPointer(s->segMan); @@ -1780,7 +1780,7 @@ int _k_view_list_dispose_loop(EngineState *s, List *list, GfxDynView *widget, in reg_t obj = make_reg(widget->_ID, widget->_subID); reg_t under_bits = NULL_REG; - if (!is_object(s->segMan, obj)) { + if (!s->segMan->isObject(obj)) { error("Non-object %04x:%04x present in view list during delete time", PRINT_REG(obj)); obj = NULL_REG; } else { @@ -1798,7 +1798,7 @@ int _k_view_list_dispose_loop(EngineState *s, List *list, GfxDynView *widget, in } } } - if (is_object(segMan, obj)) { + if (segMan->isObject(obj)) { if (invoke_selector(INV_SEL(obj, delete_, kContinueOnInvalidSelector), 0)) warning("Object at %04x:%04x requested deletion, but does not have a delete funcselector", PRINT_REG(obj)); if (_k_animate_ran) { diff --git a/engines/sci/engine/kscripts.cpp b/engines/sci/engine/kscripts.cpp index d0b75aff96..d0d34caf03 100644 --- a/engines/sci/engine/kscripts.cpp +++ b/engines/sci/engine/kscripts.cpp @@ -107,10 +107,6 @@ int invoke_selector(EngineState *s, reg_t object, int selector_id, SelectorInvoc return 0; } -bool is_object(SegManager *segMan, reg_t object) { - return segMan->getObject(object) != NULL; -} - // Loads arbitrary resources of type 'restype' with resource numbers 'resnrs' // This implementation ignores all resource numbers except the first one. reg_t kLoad(EngineState *s, int, int argc, reg_t *argv) { diff --git a/engines/sci/engine/ksound.cpp b/engines/sci/engine/ksound.cpp index 4d5517235d..4399de1443 100644 --- a/engines/sci/engine/ksound.cpp +++ b/engines/sci/engine/ksound.cpp @@ -165,7 +165,7 @@ void process_sound_events(EngineState *s) { /* Get all sound events, apply their while ((result = s->_sound.sfx_poll(&handle, &cue))) { reg_t obj = DEFROBNICATE_HANDLE(handle); - if (!is_object(s->segMan, obj)) { + if (!s->segMan->isObject(obj)) { warning("Non-object %04x:%04x received sound signal (%d/%d)", PRINT_REG(obj), result, cue); return; } diff --git a/engines/sci/engine/seg_manager.h b/engines/sci/engine/seg_manager.h index 33f9084ae0..41ff119dcc 100644 --- a/engines/sci/engine/seg_manager.h +++ b/engines/sci/engine/seg_manager.h @@ -353,6 +353,13 @@ public: Object *getObject(reg_t pos); /** + * Checks whether a heap address contains an object + * @parm obj The address to check + * @return True if it is an object, false otherwise + */ + bool isObject(reg_t obj) { return getObject(obj) != NULL; } + + /** * Determines the name of an object * @param[in] pos Location (segment, offset) of the object * @return A name for that object, or a string describing an error |