diff options
author | Filippos Karapetis | 2009-05-18 07:55:13 +0000 |
---|---|---|
committer | Filippos Karapetis | 2009-05-18 07:55:13 +0000 |
commit | 1239949ef2acf3179ef76fac1850aaa19792ffd9 (patch) | |
tree | 66446bc491d28688a7d64b326867a180f874f13a /engines | |
parent | 243bb790e80dee444e6d895b1a70a98f1c47b836 (diff) | |
download | scummvm-rg350-1239949ef2acf3179ef76fac1850aaa19792ffd9.tar.gz scummvm-rg350-1239949ef2acf3179ef76fac1850aaa19792ffd9.tar.bz2 scummvm-rg350-1239949ef2acf3179ef76fac1850aaa19792ffd9.zip |
Changed errors to be fatal, as most of them are fatal conditions. Some of them have been changed to warnings for now, as they occur in certain games (e.g. SQ4 floppy, SQ4 CD and KQ5 CD)
svn-id: r40675
Diffstat (limited to 'engines')
-rw-r--r-- | engines/sci/engine/kdebug.cpp | 5 | ||||
-rw-r--r-- | engines/sci/engine/kdebug.h | 2 | ||||
-rw-r--r-- | engines/sci/engine/kernel.cpp | 16 | ||||
-rw-r--r-- | engines/sci/engine/kfile.cpp | 5 | ||||
-rw-r--r-- | engines/sci/engine/kgraphics.cpp | 50 | ||||
-rw-r--r-- | engines/sci/engine/klists.cpp | 36 | ||||
-rw-r--r-- | engines/sci/engine/kmovement.cpp | 8 | ||||
-rw-r--r-- | engines/sci/engine/kscripts.cpp | 13 | ||||
-rw-r--r-- | engines/sci/engine/kstring.cpp | 10 | ||||
-rw-r--r-- | engines/sci/engine/stringfrag.cpp | 6 |
10 files changed, 76 insertions, 75 deletions
diff --git a/engines/sci/engine/kdebug.cpp b/engines/sci/engine/kdebug.cpp index d1d89f6c1b..686d841dd1 100644 --- a/engines/sci/engine/kdebug.cpp +++ b/engines/sci/engine/kdebug.cpp @@ -36,10 +36,7 @@ int sci_debug_flags = 0; // Special flags void _SCIkwarn(EngineState *s, const char *file, int line, int area, const char *format, ...) { va_list args; - if (area == SCIkERROR_NR) - fprintf(stderr, "ERROR: "); - else - fprintf(stderr, "Warning: "); + fprintf(stderr, "Warning: "); va_start(args, format); vfprintf(stderr, format, args); diff --git a/engines/sci/engine/kdebug.h b/engines/sci/engine/kdebug.h index 1fb3a2ee1c..45753a1b29 100644 --- a/engines/sci/engine/kdebug.h +++ b/engines/sci/engine/kdebug.h @@ -34,7 +34,6 @@ struct EngineState; #define SCIk_DEBUG_MODES 17 -#define SCIkERROR_NR -2 #define SCIkWARNING_NR -1 #define SCIkFUNCCHK_NR 5 #define SCIkSOUNDCHK_NR 7 @@ -43,7 +42,6 @@ struct EngineState; #define SCIkPARSER_NR 10 #define SCIkAVOIDPATH_NR 17 -#define SCIkERROR s, __FILE__, __LINE__, SCIkERROR_NR #define SCIkNODES s, __FILE__, __LINE__, 1 #define SCIkGRAPHICS s, __FILE__, __LINE__, 2 #define SCIkSTRINGS s, __FILE__, __LINE__, 3 diff --git a/engines/sci/engine/kernel.cpp b/engines/sci/engine/kernel.cpp index ad9b57c54f..831a7a2d6f 100644 --- a/engines/sci/engine/kernel.cpp +++ b/engines/sci/engine/kernel.cpp @@ -241,7 +241,7 @@ byte *kmem(EngineState *s, reg_t handle) { HunkTable *ht = (HunkTable *)GET_SEGMENT(*s->seg_manager, handle.segment, MEM_OBJ_HUNK); if (!ht || !ENTRY_IS_VALID(ht, handle.offset)) { - SCIkwarn(SCIkERROR, "Error: kmem() with invalid handle\n"); + error("Error: kmem() with invalid handle\n"); return NULL; } @@ -404,7 +404,7 @@ reg_t kMemory(EngineState *s, int funct_nr, int argc, reg_t *argv) { switch (UKPV(0)) { case K_MEMORY_ALLOCATE_CRITICAL : if (!s->seg_manager->allocDynmem(UKPV(1), "kMemory() critical", &s->r_acc)) { - SCIkwarn(SCIkERROR, "Critical heap allocation failed\n"); + error("Critical heap allocation failed\n"); script_error_flag = script_debug_flag = 1; } return s->r_acc; @@ -414,7 +414,7 @@ reg_t kMemory(EngineState *s, int funct_nr, int argc, reg_t *argv) { break; case K_MEMORY_FREE : if (s->seg_manager->freeDynmem(argv[1])) { - SCIkwarn(SCIkERROR, "Attempt to kMemory::free() non-dynmem pointer "PREG"!\n", PRINT_REG(argv[1])); + error("Attempt to kMemory::free() non-dynmem pointer "PREG"!\n", PRINT_REG(argv[1])); } break; case K_MEMORY_MEMCPY : { @@ -439,7 +439,7 @@ reg_t kMemory(EngineState *s, int funct_nr, int argc, reg_t *argv) { byte *ref = kernel_dereference_bulk_pointer(s, argv[1], 2); if (!ref) { - SCIkdebug(SCIkERROR, "Attempt to poke invalid memory at "PREG"!\n", PRINT_REG(argv[1])); + error("Attempt to poke invalid memory at "PREG"!\n", PRINT_REG(argv[1])); return s->r_acc; } if (s->seg_manager->_heap[argv[1].segment]->getType() == MEM_OBJ_LOCALS) @@ -452,7 +452,7 @@ reg_t kMemory(EngineState *s, int funct_nr, int argc, reg_t *argv) { byte *ref = kernel_dereference_bulk_pointer(s, argv[1], 2); if (!ref) { - SCIkdebug(SCIkERROR, "Attempt to poke invalid memory at "PREG"!\n", PRINT_REG(argv[1])); + error("Attempt to poke invalid memory at "PREG"!\n", PRINT_REG(argv[1])); return s->r_acc; } @@ -460,7 +460,7 @@ reg_t kMemory(EngineState *s, int funct_nr, int argc, reg_t *argv) { *((reg_t *) ref) = argv[2]; else { if (argv[2].segment) { - SCIkdebug(SCIkERROR, "Attempt to poke memory reference "PREG" to "PREG"!\n", PRINT_REG(argv[2]), PRINT_REG(argv[1])); + error("Attempt to poke memory reference "PREG" to "PREG"!\n", PRINT_REG(argv[2]), PRINT_REG(argv[1])); return s->r_acc; WRITE_LE_UINT16(ref, argv[2].offset); // ??? } @@ -763,12 +763,12 @@ static void *_kernel_dereference_pointer(EngineState *s, reg_t pointer, int entr void *retval = s->seg_manager->dereference(pointer, &maxsize); if (pointer.offset & (align - 1)) { - SCIkdebug(SCIkERROR, "Unaligned pointer read: "PREG" expected with %d alignment!\n", PRINT_REG(pointer), align); + error("Unaligned pointer read: "PREG" expected with %d alignment!\n", PRINT_REG(pointer), align); return NULL; } if (entries > maxsize) { - SCIkdebug(SCIkERROR, "Trying to dereference pointer "PREG" beyond end of segment!\n", PRINT_REG(pointer)); + error("Trying to dereference pointer "PREG" beyond end of segment!\n", PRINT_REG(pointer)); return NULL; } return retval; diff --git a/engines/sci/engine/kfile.cpp b/engines/sci/engine/kfile.cpp index ee80af6a72..23c9d90047 100644 --- a/engines/sci/engine/kfile.cpp +++ b/engines/sci/engine/kfile.cpp @@ -408,7 +408,8 @@ reg_t kDeviceInfo(EngineState *s, int funct_nr, int argc, reg_t *argv) { break; default: - SCIkwarn(SCIkERROR, "Unknown DeviceInfo() sub-command: %d\n", mode); + // TODO: Not all sub-commands are handled. E.g. KQ5CD calls sub-command 5 + warning("Unknown DeviceInfo() sub-command: %d\n", mode); break; } @@ -848,7 +849,7 @@ reg_t kFileIO(EngineState *s, int funct_nr, int argc, reg_t *argv) { break; } default : - SCIkwarn(SCIkERROR, "Unknown FileIO() sub-command: %d\n", func_nr); + error("Unknown FileIO() sub-command: %d\n", func_nr); } return s->r_acc; diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp index 602a5e8bbf..fe7508f49d 100644 --- a/engines/sci/engine/kgraphics.cpp +++ b/engines/sci/engine/kgraphics.cpp @@ -98,7 +98,7 @@ enum { if (val == GFX_ERROR) \ warning("GFX subsystem returned error on \"" #x "\""); \ else {\ - SCIkwarn(SCIkERROR, "GFX subsystem fatal error condition on \"" #x "\"!\n"); \ + error("GFX subsystem fatal error condition on \"" #x "\"!\n"); \ vm_handle_fatal_error(s, __LINE__, __FILE__); \ } \ }\ @@ -107,7 +107,7 @@ enum { #define ASSERT(x) { \ int val = !!(x); \ if (!val) { \ - SCIkwarn(SCIkERROR, "Fatal error condition on \"" #x "\"!\n"); \ + error("Fatal error condition on \"" #x "\"!\n"); \ BREAKPOINT(); \ vm_handle_fatal_error(s, __LINE__, __FILE__); \ } \ @@ -226,7 +226,7 @@ void graph_restore_box(EngineState *s, reg_t handle) { while (port_nr > 2 && !(s->port->_flags & GFXW_FLAG_IMMUNE_TO_SNAPSHOTS) && (gfxw_widget_matches_snapshot(*ptr, s->port))) { // This shouldn't ever happen, actually, since windows (ports w/ ID > 2) should all be immune GfxPort *newport = gfxw_find_port(s->visual, port_nr); - SCIkwarn(SCIkERROR, "Port %d is not immune against snapshots!\n", s->port->_ID); + error("Port %d is not immune against snapshots!\n", s->port->_ID); port_nr--; if (newport) s->port = newport; @@ -240,7 +240,7 @@ void graph_restore_box(EngineState *s, reg_t handle) { } while (parent && (gfxw_widget_matches_snapshot(*ptr, parent))); if (!parent) { - SCIkwarn(SCIkERROR, "Attempted widget mass destruction by a snapshot\n"); + error("Attempted widget mass destruction by a snapshot\n"); BREAKPOINT(); } @@ -249,7 +249,7 @@ void graph_restore_box(EngineState *s, reg_t handle) { if (!ptr) { - SCIkwarn(SCIkERROR, "Attempt to restore invalid snaphot with handle %04x!\n", handle); + error("Attempt to restore invalid snaphot with handle %04x!\n", handle); return; } @@ -269,7 +269,7 @@ PaletteEntry get_pic_color(EngineState *s, int color) { else if (color < s->gfx_state->gfxResMan->getColorCount()) return s->gfx_state->gfxResMan->getColor(color); else { - SCIkwarn(SCIkERROR, "Color index %d out of bounds for pic %d (%d max)", color, s->gfx_state->pic_nr, s->gfx_state->gfxResMan->getColorCount()); + error("Color index %d out of bounds for pic %d (%d max)", color, s->gfx_state->pic_nr, s->gfx_state->gfxResMan->getColorCount()); BREAKPOINT(); return PaletteEntry(0,0,0); } @@ -343,7 +343,7 @@ reg_t kSetCursor(EngineState *s, int funct_nr, int argc, reg_t *argv) { break; } default : - SCIkwarn(SCIkERROR, "kSetCursor: Unhandled case: %d arguments given!\n", argc); + error("kSetCursor: Unhandled case: %d arguments given!\n", argc); break; } return s->r_acc; @@ -698,7 +698,7 @@ void _k_dirloop(reg_t obj, uint16 angle, EngineState *s, int funct_nr, int argc, maxloops = gfxop_lookup_view_get_loops(s->gfx_state, view); if (maxloops == GFX_ERROR) { - SCIkwarn(SCIkERROR, "Invalid view.%03d\n", view); + error("Invalid view.%03d\n", view); return; } else if ((loop > 1) && (maxloops < 4)) return; @@ -886,7 +886,7 @@ reg_t kCelHigh(EngineState *s, int funct_nr, int argc, reg_t *argv) { } if (gfxop_get_cel_parameters(s->gfx_state, view, loop, cel, &width, &height, &offset)) { - SCIkwarn(SCIkERROR, "Invalid loop (%d) or cel (%d) in view.%d (0x%x), or view invalid\n", loop, cel, view, view); + error("Invalid loop (%d) or cel (%d) in view.%d (0x%x), or view invalid\n", loop, cel, view, view); return NULL_REG; } else return make_reg(0, height); @@ -904,7 +904,7 @@ reg_t kCelWide(EngineState *s, int funct_nr, int argc, reg_t *argv) { } if (gfxop_get_cel_parameters(s->gfx_state, view, loop, cel, &width, &height, &offset)) { - SCIkwarn(SCIkERROR, "Invalid loop (%d) or cel (%d) in view.%d (0x%x), or view invalid\n", loop, cel, view, view); + error("Invalid loop (%d) or cel (%d) in view.%d (0x%x), or view invalid\n", loop, cel, view, view); return NULL_REG; } else return make_reg(0, width); @@ -916,7 +916,7 @@ reg_t kNumLoops(EngineState *s, int funct_nr, int argc, reg_t *argv) { int loops_nr = gfxop_lookup_view_get_loops(s->gfx_state, view); if (loops_nr < 0) { - SCIkwarn(SCIkERROR, "view.%d (0x%x) not found\n", view, view); + error("view.%d (0x%x) not found\n", view, view); return NULL_REG; } @@ -935,7 +935,7 @@ reg_t kNumCels(EngineState *s, int funct_nr, int argc, reg_t *argv) { if (gfxop_check_cel(s->gfx_state, view, &loop, &cel)) { // OK, this is a hack and there's a // real function to calculate cel numbers... - SCIkwarn(SCIkERROR, "view.%d (0x%x) not found\n", view, view); + error("view.%d (0x%x) not found\n", view, view); return NULL_REG; } @@ -1815,7 +1815,7 @@ int _k_view_list_dispose_loop(EngineState *s, List *list, GfxDynView *widget, in reg_t under_bits = NULL_REG; if (!is_object(s, obj)) { - SCIkwarn(SCIkERROR, "Non-object "PREG" present in view list during delete time\n", PRINT_REG(obj)); + error("Non-object "PREG" present in view list during delete time\n", PRINT_REG(obj)); obj = NULL_REG; } else if (widget->under_bitsp) { // Is there a bg picture left to clean? @@ -1852,7 +1852,7 @@ int _k_view_list_dispose_loop(EngineState *s, List *list, GfxDynView *widget, in if (!(signal & _K_VIEW_SIG_FLAG_HIDDEN)) { SCIkdebug(SCIkGRAPHICS, "Adding view at "PREG" to background\n", PRINT_REG(obj)); if (!(gfxw_remove_id(widget->_parent, widget->_ID, widget->_subID) == widget)) { - SCIkwarn(SCIkERROR, "Attempt to remove view with ID %x:%x from list failed!\n", widget->_ID, widget->_subID); + error("Attempt to remove view with ID %x:%x from list failed!\n", widget->_ID, widget->_subID); BREAKPOINT(); } @@ -1970,7 +1970,7 @@ static void _k_make_view_list(EngineState *s, GfxList **widget_list, List *list, GfxDynView *widget; if (!*widget_list) { - SCIkwarn(SCIkERROR, "make_view_list with widget_list == ()\n"); + error("make_view_list with widget_list == ()\n"); BREAKPOINT(); }; @@ -1979,7 +1979,7 @@ static void _k_make_view_list(EngineState *s, GfxList **widget_list, List *list, // Yes, this _does_ happen! if (!list) { // list sanity check - SCIkwarn(SCIkERROR, "Attempt to make list from non-list!\n"); + error("Attempt to make list from non-list!\n"); BREAKPOINT(); } @@ -2295,7 +2295,7 @@ reg_t kAddToPic(EngineState *s, int funct_nr, int argc, reg_t *argv) { priority, -1 /* No priority */ , ALIGN_CENTER, ALIGN_BOTTOM, 0); if (!widget) { - SCIkwarn(SCIkERROR, "Attempt to single-add invalid picview (%d/%d/%d)\n", view, loop, cel); + error("Attempt to single-add invalid picview (%d/%d/%d)\n", view, loop, cel); } else { widget->_ID = -1; if (control >= 0) { @@ -2359,7 +2359,7 @@ reg_t kSetPort(EngineState *s, int funct_nr, int argc, reg_t *argv) { new_port = gfxw_find_port(s->visual, port_nr); if (!new_port) { - SCIkwarn(SCIkERROR, "Invalid port %04x requested\n", port_nr); + error("Invalid port %04x requested\n", port_nr); return NULL_REG; } @@ -2388,7 +2388,7 @@ reg_t kSetPort(EngineState *s, int funct_nr, int argc, reg_t *argv) { break; } default : - SCIkwarn(SCIkERROR, "SetPort was called with %d parameters\n", argc); + error("SetPort was called with %d parameters\n", argc); break; } @@ -2406,13 +2406,13 @@ reg_t kDrawCel(EngineState *s, int funct_nr, int argc, reg_t *argv) { /* if (!view) { - SCIkwarn(SCIkERROR, "Attempt to draw non-existing view.%03d\n", view); + error("Attempt to draw non-existing view.%03d\n", view); return; } */ if (gfxop_check_cel(s->gfx_state, view, &loop, &cel)) { - SCIkwarn(SCIkERROR, "Attempt to draw non-existing view.%03d\n", view); + error("Attempt to draw non-existing view.%03d\n", view); return s->r_acc; } @@ -2434,7 +2434,7 @@ reg_t kDisposeWindow(EngineState *s, int funct_nr, int argc, reg_t *argv) { goner = gfxw_find_port(s->visual, goner_nr); if ((goner_nr < 3) || (goner == NULL)) { - SCIkwarn(SCIkERROR, "Removal of invalid window %04x requested\n", goner_nr); + error("Removal of invalid window %04x requested\n", goner_nr); return s->r_acc; } @@ -2595,7 +2595,7 @@ static void animate_do_animation(EngineState *s, int funct_nr, int argc, reg_t * gfxop_set_clip_zone(s->gfx_state, gfx_rect_fullscreen); if (!newscreen) { - SCIkwarn(SCIkERROR, "Failed to allocate 'newscreen'!\n"); + error("Failed to allocate 'newscreen'!\n"); return; } @@ -3162,7 +3162,7 @@ reg_t kDisplay(EngineState *s, int funct_nr, int argc, reg_t *argv) { } if (!text) { - SCIkdebug(SCIkERROR, "Display with invalid reference "PREG"!\n", PRINT_REG(textp)); + error("Display with invalid reference "PREG"!\n", PRINT_REG(textp)); return NULL_REG; } @@ -3286,7 +3286,7 @@ reg_t kDisplay(EngineState *s, int funct_nr, int argc, reg_t *argv) { text_handle = gfxw_new_text(s->gfx_state, area, font_nr, text, halign, ALIGN_TOP, color0, *color1, bg_color, 0); if (!text_handle) { - SCIkwarn(SCIkERROR, "Display: Failed to create text widget!\n"); + error("Display: Failed to create text widget!\n"); return NULL_REG; } diff --git a/engines/sci/engine/klists.cpp b/engines/sci/engine/klists.cpp index da115499a0..2aa6ea2f48 100644 --- a/engines/sci/engine/klists.cpp +++ b/engines/sci/engine/klists.cpp @@ -38,7 +38,7 @@ Node *lookup_node(EngineState *s, reg_t addr, const char *file, int line) { // seem to have any apparent ill-effects, though, so it's been changed to non-fatal, for now //sciprintf("%s, L%d: Attempt to use non-node "PREG" as list node\n", __FILE__, __LINE__, PRINT_REG(addr)); //script_debug_flag = script_error_flag = 1; - SCIkwarn(SCIkERROR, "%s, L%d: Attempt to use non-node "PREG" as list node\n", __FILE__, __LINE__, PRINT_REG(addr)); + warning("%s, L%d: Attempt to use non-node "PREG" as list node\n", __FILE__, __LINE__, PRINT_REG(addr)); return NULL; } @@ -150,12 +150,13 @@ reg_t kDisposeList(EngineState *s, int funct_nr, int argc, reg_t *argv) { List *l = LOOKUP_LIST(argv[0]); if (!l) { - SCIkwarn(SCIkERROR, "Attempt to dispose non-list at "PREG"!\n", PRINT_REG(argv[0])); + // FIXME: This should be an error, but it's turned to a warning for now + warning("Attempt to dispose non-list at "PREG"!\n", PRINT_REG(argv[0])); return NULL_REG; } if (!sane_listp(s, argv[0])) - SCIkwarn(SCIkERROR, "List at "PREG" is not sane anymore!\n", PRINT_REG(argv[0])); + error("List at "PREG" is not sane anymore!\n", PRINT_REG(argv[0])); /* if (!IS_NULL_REG(l->first)) { reg_t n_addr = l->first; @@ -202,7 +203,7 @@ reg_t kFirstNode(EngineState *s, int funct_nr, int argc, reg_t *argv) { List *l = LOOKUP_LIST(argv[0]); if (l && !sane_listp(s, argv[0])) - SCIkwarn(SCIkERROR, "List at "PREG" is not sane anymore!\n", PRINT_REG(argv[0])); + error("List at "PREG" is not sane anymore!\n", PRINT_REG(argv[0])); if (l) return l->first; @@ -214,7 +215,7 @@ reg_t kLastNode(EngineState *s, int funct_nr, int argc, reg_t *argv) { List *l = LOOKUP_LIST(argv[0]); if (l && !sane_listp(s, argv[0])) - SCIkwarn(SCIkERROR, "List at "PREG" is not sane anymore!\n", PRINT_REG(argv[0])); + error("List at "PREG" is not sane anymore!\n", PRINT_REG(argv[0])); if (l) return l->last; @@ -226,7 +227,7 @@ reg_t kEmptyList(EngineState *s, int funct_nr, int argc, reg_t *argv) { List *l = LOOKUP_LIST(argv[0]); if (!l || !sane_listp(s, argv[0])) - SCIkwarn(SCIkERROR, "List at "PREG" is invalid or not sane anymore!\n", PRINT_REG(argv[0])); + error("List at "PREG" is invalid or not sane anymore!\n", PRINT_REG(argv[0])); return make_reg(0, ((l) ? IS_NULL_REG(l->first) : 0)); } @@ -237,10 +238,11 @@ void _k_add_to_front(EngineState *s, reg_t listbase, reg_t nodebase) { SCIkdebug(SCIkNODES, "Adding node "PREG" to end of list "PREG"\n", PRINT_REG(nodebase), PRINT_REG(listbase)); + // FIXME: This should be an error, but it's turned to a warning for now if (!new_n) - SCIkwarn(SCIkERROR, "Attempt to add non-node ("PREG") to list at "PREG"\n", PRINT_REG(nodebase), PRINT_REG(listbase)); + warning("Attempt to add non-node ("PREG") to list at "PREG"\n", PRINT_REG(nodebase), PRINT_REG(listbase)); if (!l || !sane_listp(s, listbase)) - SCIkwarn(SCIkERROR, "List at "PREG" is not sane anymore!\n", PRINT_REG(listbase)); + error("List at "PREG" is not sane anymore!\n", PRINT_REG(listbase)); new_n->succ = l->first; new_n->pred = NULL_REG; @@ -260,10 +262,11 @@ void _k_add_to_end(EngineState *s, reg_t listbase, reg_t nodebase) { SCIkdebug(SCIkNODES, "Adding node "PREG" to end of list "PREG"\n", PRINT_REG(nodebase), PRINT_REG(listbase)); + // FIXME: This should be an error, but it's turned to a warning for now if (!new_n) - SCIkwarn(SCIkERROR, "Attempt to add non-node ("PREG") to list at "PREG"\n", PRINT_REG(nodebase), PRINT_REG(listbase)); + warning("Attempt to add non-node ("PREG") to list at "PREG"\n", PRINT_REG(nodebase), PRINT_REG(listbase)); if (!l || !sane_listp(s, listbase)) - SCIkwarn(SCIkERROR, "List at "PREG" is not sane anymore!\n", PRINT_REG(listbase)); + error("List at "PREG" is not sane anymore!\n", PRINT_REG(listbase)); new_n->succ = NULL_REG; new_n->pred = l->last; @@ -280,7 +283,7 @@ void _k_add_to_end(EngineState *s, reg_t listbase, reg_t nodebase) { reg_t kNextNode(EngineState *s, int funct_nr, int argc, reg_t *argv) { Node *n = LOOKUP_NODE(argv[0]); if (!sane_nodep(s, argv[0])) { - SCIkwarn(SCIkERROR, "List node at "PREG" is not sane anymore!\n", PRINT_REG(argv[0])); + error("List node at "PREG" is not sane anymore!\n", PRINT_REG(argv[0])); script_error_flag = script_debug_flag = 0; return NULL_REG; } @@ -291,7 +294,7 @@ reg_t kNextNode(EngineState *s, int funct_nr, int argc, reg_t *argv) { reg_t kPrevNode(EngineState *s, int funct_nr, int argc, reg_t *argv) { Node *n = LOOKUP_NODE(argv[0]); if (!sane_nodep(s, argv[0])) - SCIkwarn(SCIkERROR, "List node at "PREG" is not sane anymore!\n", PRINT_REG(argv[0])); + error("List node at "PREG" is not sane anymore!\n", PRINT_REG(argv[0])); return n->pred; } @@ -299,7 +302,7 @@ reg_t kPrevNode(EngineState *s, int funct_nr, int argc, reg_t *argv) { reg_t kNodeValue(EngineState *s, int funct_nr, int argc, reg_t *argv) { Node *n = LOOKUP_NODE(argv[0]); if (!sane_nodep(s, argv[0])) { - SCIkwarn(SCIkERROR, "List node at "PREG" is not sane!\n", PRINT_REG(argv[0])); + error("List node at "PREG" is not sane!\n", PRINT_REG(argv[0])); script_debug_flag = script_error_flag = 0; return NULL_REG; } @@ -318,10 +321,11 @@ reg_t kAddAfter(EngineState *s, int funct_nr, int argc, reg_t *argv) { Node *newnode = LOOKUP_NODE(argv[2]); if (!l || !sane_listp(s, argv[0])) - SCIkwarn(SCIkERROR, "List at "PREG" is not sane anymore!\n", PRINT_REG(argv[0])); + error("List at "PREG" is not sane anymore!\n", PRINT_REG(argv[0])); + // FIXME: This should be an error, but it's turned to a warning for now if (!newnode) { - SCIkwarn(SCIkERROR, "New 'node' "PREG" is not a node!\n", argv[1], argv[2]); + warning("New 'node' "PREG" is not a node!\n", argv[1], argv[2]); return NULL_REG; } @@ -364,7 +368,7 @@ reg_t kFindKey(EngineState *s, int funct_nr, int argc, reg_t *argv) { SCIkdebug(SCIkNODES, "Looking for key "PREG" in list "PREG"\n", PRINT_REG(key), PRINT_REG(list_pos)); if (!sane_listp(s, list_pos)) - SCIkwarn(SCIkERROR, "List at "PREG" is not sane anymore!\n", PRINT_REG(list_pos)); + error("List at "PREG" is not sane anymore!\n", PRINT_REG(list_pos)); node_pos = LOOKUP_LIST(list_pos)->first; diff --git a/engines/sci/engine/kmovement.cpp b/engines/sci/engine/kmovement.cpp index 9b28c1fa6d..33e1faceec 100644 --- a/engines/sci/engine/kmovement.cpp +++ b/engines/sci/engine/kmovement.cpp @@ -426,7 +426,7 @@ reg_t kDoAvoider(EngineState *s, int funct_nr, int argc, reg_t *argv) { SCIkdebug(SCIkBRESEN, "Doing avoider %04x (dest=%d,%d)\n", avoider, destx, desty); if (invoke_selector(INV_SEL(mover, doit, 1) , 0)) { - SCIkwarn(SCIkERROR, "Mover "PREG" of avoider "PREG" doesn't have a doit() funcselector\n", PRINT_REG(mover), PRINT_REG(avoider)); + error("Mover "PREG" of avoider "PREG" doesn't have a doit() funcselector\n", PRINT_REG(mover), PRINT_REG(avoider)); return NULL_REG; } @@ -435,7 +435,7 @@ reg_t kDoAvoider(EngineState *s, int funct_nr, int argc, reg_t *argv) { return s->r_acc; // Return gracefully. if (invoke_selector(INV_SEL(client, isBlocked, 1) , 0)) { - SCIkwarn(SCIkERROR, "Client "PREG" of avoider "PREG" doesn't" + error("Client "PREG" of avoider "PREG" doesn't" " have an isBlocked() funcselector", PRINT_REG(client), PRINT_REG(avoider)); return NULL_REG; } @@ -466,7 +466,7 @@ reg_t kDoAvoider(EngineState *s, int funct_nr, int argc, reg_t *argv) { SCIkdebug(SCIkBRESEN, "Pos (%d,%d): Trying angle %d; delta=(%d,%d)\n", oldx, oldy, angle, move_x, move_y); if (invoke_selector(INV_SEL(client, canBeHere, 1) , 0)) { - SCIkwarn(SCIkERROR, "Client "PREG" of avoider "PREG" doesn't" + error("Client "PREG" of avoider "PREG" doesn't" " have a canBeHere() funcselector", PRINT_REG(client), PRINT_REG(avoider)); return NULL_REG; } @@ -500,7 +500,7 @@ reg_t kDoAvoider(EngineState *s, int funct_nr, int argc, reg_t *argv) { if (looper.segment) { if (invoke_selector(INV_SEL(looper, doit, 1), 2, angle, client)) { - SCIkwarn(SCIkERROR, "Looper "PREG" of avoider "PREG" doesn't" + error("Looper "PREG" of avoider "PREG" doesn't" " have a doit() funcselector", PRINT_REG(looper), PRINT_REG(avoider)); } else return s->r_acc; diff --git a/engines/sci/engine/kscripts.cpp b/engines/sci/engine/kscripts.cpp index bb4c98761f..1598cdcc56 100644 --- a/engines/sci/engine/kscripts.cpp +++ b/engines/sci/engine/kscripts.cpp @@ -74,7 +74,7 @@ int invoke_selector(EngineState *s, reg_t object, int selector_id, int noinvalid slc_type = lookup_selector(s, object, selector_id, NULL, &address); if (slc_type == kSelectorNone) { - SCIkwarn(SCIkERROR, "Selector '%s' of object at "PREG" could not be invoked (%s L%d)\n", + error("Selector '%s' of object at "PREG" could not be invoked (%s L%d)\n", s->_selectorNames[selector_id].c_str(), PRINT_REG(object), fname, line); if (noinvalid == 0) KERNEL_OOPS("Not recoverable: VM was halted\n"); @@ -163,7 +163,7 @@ reg_t kClone(EngineState *s, int funct_nr, int argc, reg_t *argv) { Clone *clone_obj; // same as Object* if (!parent_obj) { - SCIkwarn(SCIkERROR, "Attempt to clone non-object/class at "PREG" failed", PRINT_REG(parent_addr)); + error("Attempt to clone non-object/class at "PREG" failed", PRINT_REG(parent_addr)); return NULL_REG; } @@ -172,7 +172,7 @@ reg_t kClone(EngineState *s, int funct_nr, int argc, reg_t *argv) { clone_obj = s->seg_manager->alloc_Clone(&clone_addr); if (!clone_obj) { - SCIkwarn(SCIkERROR, "Cloning "PREG" failed-- internal error!\n", PRINT_REG(parent_addr)); + error("Cloning "PREG" failed-- internal error!\n", PRINT_REG(parent_addr)); return NULL_REG; } @@ -198,7 +198,7 @@ reg_t kDisposeClone(EngineState *s, int funct_nr, int argc, reg_t *argv) { uint16 underBits; if (!victim_obj) { - SCIkwarn(SCIkERROR, "Attempt to dispose non-class/object at "PREG"\n", + error("Attempt to dispose non-class/object at "PREG"\n", PRINT_REG(victim_addr)); return s->r_acc; } @@ -246,12 +246,13 @@ reg_t kScriptID(EngineState *s, int funct_nr, int argc, reg_t *argv) { scr = s->seg_manager->getScript(scriptid); if (!scr->exports_nr) { - SCIkdebug(SCIkERROR, "Script 0x%x does not have a dispatch table\n", script); + // FIXME: Is this fatal? This occurs in SQ4CD + warning("Script 0x%x does not have a dispatch table\n", script); return NULL_REG; } if (index > scr->exports_nr) { - SCIkwarn(SCIkERROR, "Dispatch index too big: %d > %d\n", index, scr->exports_nr); + error("Dispatch index too big: %d > %d\n", index, scr->exports_nr); return NULL_REG; } diff --git a/engines/sci/engine/kstring.cpp b/engines/sci/engine/kstring.cpp index 0be3ac706b..82b72e4a9e 100644 --- a/engines/sci/engine/kstring.cpp +++ b/engines/sci/engine/kstring.cpp @@ -34,7 +34,7 @@ namespace Sci { #define CHECK_OVERFLOW1(pt, size, rv) \ if (((pt) - (str_base)) + (size) > maxsize) { \ - SCIkwarn(SCIkERROR, "String expansion exceeded heap boundaries\n"); \ + error("String expansion exceeded heap boundaries\n"); \ return rv;\ } @@ -51,7 +51,7 @@ char *kernel_lookup_text(EngineState *s, reg_t address, int index) { textres = s->resmgr->findResource(kResourceTypeText, address.offset, 0); if (!textres) { - SCIkwarn(SCIkERROR, "text.%03d not found\n", address); + error("text.%03d not found\n", address); return NULL; /* Will probably segfault */ } @@ -65,7 +65,7 @@ char *kernel_lookup_text(EngineState *s, reg_t address, int index) { if (textlen) return seeker; else { - SCIkwarn(SCIkERROR, "Index %d out of bounds in text.%03d\n", _index, address); + error("Index %d out of bounds in text.%03d\n", _index, address); return 0; } @@ -211,7 +211,7 @@ reg_t kSetSynonyms(EngineState *s, int funct_nr, int argc, reg_t *argv) { synonyms_nr, script); if (synonyms_nr > 16384) { - SCIkwarn(SCIkERROR, "Segtable corruption: script.%03d has %d synonyms!\n", + error("Segtable corruption: script.%03d has %d synonyms!\n", script, synonyms_nr); /* We used to reset the corrupted value here. I really don't think it's appropriate. * Lars */ @@ -706,7 +706,7 @@ reg_t kGetFarText(EngineState *s, int funct_nr, int argc, reg_t *argv) { if (!textres) { - SCIkwarn(SCIkERROR, "text.%d does not exist\n", UKPV(0)); + error("text.%d does not exist\n", UKPV(0)); return NULL_REG; } diff --git a/engines/sci/engine/stringfrag.cpp b/engines/sci/engine/stringfrag.cpp index a37d2063d9..b616dea912 100644 --- a/engines/sci/engine/stringfrag.cpp +++ b/engines/sci/engine/stringfrag.cpp @@ -112,14 +112,14 @@ static int internal_stringfrag_length(EngineState *s, reg_t *buffer) { int result = 0; if (buffer == NULL) { -// SCIkwarn(SCIkERROR, "Error: Invalid stringfrag handle"); +// error("Error: Invalid stringfrag handle"); return 0; } while ((buffer->offset & 0xff00) != 0 && (buffer->offset & 0x00ff) != 0) { if (buffer->segment != STRINGFRAG_SEGMENT) { -// SCIkwarn(SCIkERROR, "Error: Invalid stringfrag handle"); +// error("Error: Invalid stringfrag handle"); return 0; } @@ -128,7 +128,7 @@ static int internal_stringfrag_length(EngineState *s, reg_t *buffer) { } if (buffer->segment != STRINGFRAG_SEGMENT) { - SCIkwarn(SCIkERROR, "Error: Invalid stringfrag handle"); + error("Error: Invalid stringfrag handle"); return 0; } |