From 031e3e3b9081ad955d4ef814829c83f4b51792f0 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Sat, 21 Feb 2009 03:25:23 +0000 Subject: SCI: Fixed tons of bugs in error/warning format strings svn-id: r38655 --- engines/sci/engine/kgraphics.cpp | 8 ++++---- engines/sci/engine/klists.cpp | 2 +- engines/sci/engine/kscripts.cpp | 4 ++-- engines/sci/engine/kstring.cpp | 22 ++++++++++------------ 4 files changed, 17 insertions(+), 19 deletions(-) (limited to 'engines/sci') diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp index 8f41ac2d91..64789031bd 100644 --- a/engines/sci/engine/kgraphics.cpp +++ b/engines/sci/engine/kgraphics.cpp @@ -208,10 +208,10 @@ void graph_restore_box(state_t *s, reg_t handle) { return; } - ptr = (gfxw_snapshot_t **) kmem(s, handle); + ptr = (gfxw_snapshot_t **)kmem(s, handle); if (!ptr) { - warning("Attempt to restore invalid handle %04x", handle); + warning("Attempt to restore invalid handle "PREG, PRINT_REG(handle)); return; } @@ -241,7 +241,7 @@ void graph_restore_box(state_t *s, reg_t handle) { if (!ptr) { - error("Attempt to restore invalid snaphot with handle %04x", handle); + error("Attempt to restore invalid snaphot with handle "PREG, PRINT_REG(handle)); return; } @@ -846,7 +846,7 @@ reg_t kCanBeHere(state_t *s, int funct_nr, int argc, reg_t * argv) { SCIkdebug(SCIkBRESEN, " comparing against "PREG"\n", PRINT_REG(other_obj)); if (!is_object(s, other_obj)) { - warning("CanBeHere() cliplist contains non-object %04x", other_obj); + warning("CanBeHere() cliplist contains non-object "PREG, PRINT_REG(other_obj)); } else if (!REG_EQ(other_obj, obj)) { // Clipping against yourself is not recommended if (collides_with(s, abs_zone, other_obj, 0, GASEOUS_VIEW_MASK_PASSIVE, funct_nr, argc, argv)) { diff --git a/engines/sci/engine/klists.cpp b/engines/sci/engine/klists.cpp index e08610a9af..66216fe813 100644 --- a/engines/sci/engine/klists.cpp +++ b/engines/sci/engine/klists.cpp @@ -341,7 +341,7 @@ reg_t kAddAfter(state_t *s, int funct_nr, int argc, reg_t *argv) { error("List at "PREG" is not sane anymore", PRINT_REG(argv[0])); if (!newnode) { - error("New 'node' "PREG" is not a node", argv[1], argv[2]); + error("New 'node' "PREG" is not a node", PRINT_REG(argv[2])); return NULL_REG; } diff --git a/engines/sci/engine/kscripts.cpp b/engines/sci/engine/kscripts.cpp index 0819965cfe..eb00bb9573 100644 --- a/engines/sci/engine/kscripts.cpp +++ b/engines/sci/engine/kscripts.cpp @@ -46,8 +46,8 @@ void write_selector(state_t *s, reg_t object, selector_t selector_id, reg_t valu } if (lookup_selector(s, object, selector_id, &address, NULL) != SELECTOR_VARIABLE) - warning("Selector '%s' of object at %04x could not be" - " written to (%s L%d)", s->selector_names[selector_id], object, fname, line); + warning("Selector '%s' of object at "PREG" could not be" + " written to (%s L%d)", s->selector_names[selector_id], PRINT_REG(object), fname, line); else *address = value; } diff --git a/engines/sci/engine/kstring.cpp b/engines/sci/engine/kstring.cpp index 7f2d82858b..dbba274871 100644 --- a/engines/sci/engine/kstring.cpp +++ b/engines/sci/engine/kstring.cpp @@ -35,22 +35,20 @@ return rv;\ } -char * -kernel_lookup_text(state_t *s, reg_t address, int index) /* Returns the string the script intended to address */ -{ +char *kernel_lookup_text(state_t *s, reg_t address, int index) { char *seeker; resource_t *textres; if (address.segment) - return (char *) kernel_dereference_bulk_pointer(s, address, 0); + return (char *)kernel_dereference_bulk_pointer(s, address, 0); else { int textlen; int _index = index; textres = scir_find_resource(s->resmgr, sci_text, address.offset, 0); if (!textres) { - error("text.%03d not found\n", address); + error("text.%03d not found", address.offset); return NULL; /* Will probably segfault */ } @@ -58,12 +56,13 @@ kernel_lookup_text(state_t *s, reg_t address, int index) seeker = (char *) textres->data; while (index--) - while ((textlen--) && (*seeker++)); + while ((textlen--) && (*seeker++)) + ; if (textlen) return seeker; else { - error("Index %d out of bounds in text.%03d\n", _index, address); + error("Index %d out of bounds in text.%03d\n", _index, address.offset); return 0; } @@ -76,8 +75,7 @@ kernel_lookup_text(state_t *s, reg_t address, int index) /**********/ #ifdef SCI_SIMPLE_SAID_CODE -int -vocab_match_simple(state_t *s, heap_ptr addr) { +int vocab_match_simple(state_t *s, heap_ptr addr) { int nextitem; int listpos = 0; @@ -112,8 +110,7 @@ vocab_match_simple(state_t *s, heap_ptr addr) { #endif /* SCI_SIMPLE_SAID_CODE */ -reg_t -kSaid(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kSaid(state_t *s, int funct_nr, int argc, reg_t *argv) { reg_t heap_said_block = argv[0]; byte *said_block; int new_lastmatch; @@ -235,7 +232,8 @@ kSetSynonyms(state_t *s, int funct_nr, int argc, reg_t *argv) { synpos++; } - } else warning("Synonyms of script.%03d were requested, but script is not available"); + } else + warning("Synonyms of script.%03d were requested, but script is not available", script); } -- cgit v1.2.3