aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/engine/klists.cpp
diff options
context:
space:
mode:
authorFilippos Karapetis2009-09-30 22:54:00 +0000
committerFilippos Karapetis2009-09-30 22:54:00 +0000
commit86016e4dc5ab081b5d5f3e3ab7cc5c9dd0cd7109 (patch)
tree1ca1aa702acf5cd426b05bcb431dbebe37374571 /engines/sci/engine/klists.cpp
parentbbb2274a7d7d57edfbf0c11271a7203c036cba7d (diff)
downloadscummvm-rg350-86016e4dc5ab081b5d5f3e3ab7cc5c9dd0cd7109.tar.gz
scummvm-rg350-86016e4dc5ab081b5d5f3e3ab7cc5c9dd0cd7109.tar.bz2
scummvm-rg350-86016e4dc5ab081b5d5f3e3ab7cc5c9dd0cd7109.zip
Changed the list sanity checks to return warnings instead of errors in case of failure - apparently, this can occur in some games, e.g. Longbow and QFG1
svn-id: r44503
Diffstat (limited to 'engines/sci/engine/klists.cpp')
-rw-r--r--engines/sci/engine/klists.cpp28
1 files changed, 14 insertions, 14 deletions
diff --git a/engines/sci/engine/klists.cpp b/engines/sci/engine/klists.cpp
index 2de0d1983d..5d881d149b 100644
--- a/engines/sci/engine/klists.cpp
+++ b/engines/sci/engine/klists.cpp
@@ -44,7 +44,7 @@ Node *lookup_node(EngineState *s, reg_t addr) {
NodeTable *nt = (NodeTable *)mobj;
if (!nt->isValidEntry(addr.offset)) {
- error("Attempt to use non-node %04x:%04x as list node", PRINT_REG(addr));
+ warning("Attempt to use non-node %04x:%04x as list node", PRINT_REG(addr));
return NULL;
}
@@ -55,14 +55,14 @@ List *lookup_list(EngineState *s, reg_t addr) {
SegmentObj *mobj = GET_SEGMENT(*s->segMan, addr.segment, SEG_TYPE_LISTS);
if (!mobj) {
- error("Attempt to use non-list %04x:%04x as list", PRINT_REG(addr));
+ warning("Attempt to use non-list %04x:%04x as list", PRINT_REG(addr));
return NULL;
}
ListTable *lt = (ListTable *)mobj;
if (!lt->isValidEntry(addr.offset)) {
- error("Attempt to use non-list %04x:%04x as list", PRINT_REG(addr));
+ warning("Attempt to use non-list %04x:%04x as list", PRINT_REG(addr));
return NULL;
}
@@ -152,7 +152,7 @@ reg_t kDisposeList(EngineState *s, int argc, reg_t *argv) {
}
if (!sane_listp(s, argv[0]))
- error("List at %04x:%04x is not sane anymore", PRINT_REG(argv[0]));
+ warning("List at %04x:%04x is not sane anymore", PRINT_REG(argv[0]));
/* if (!l->first.isNull()) {
reg_t n_addr = l->first;
@@ -199,7 +199,7 @@ reg_t kFirstNode(EngineState *s, int argc, reg_t *argv) {
List *l = lookup_list(s, argv[0]);
if (l && !sane_listp(s, argv[0]))
- error("List at %04x:%04x is not sane anymore", PRINT_REG(argv[0]));
+ warning("List at %04x:%04x is not sane anymore", PRINT_REG(argv[0]));
if (l)
return l->first;
@@ -211,7 +211,7 @@ reg_t kLastNode(EngineState *s, int argc, reg_t *argv) {
List *l = lookup_list(s, argv[0]);
if (l && !sane_listp(s, argv[0]))
- error("List at %04x:%04x is not sane anymore", PRINT_REG(argv[0]));
+ warning("List at %04x:%04x is not sane anymore", PRINT_REG(argv[0]));
if (l)
return l->last;
@@ -223,7 +223,7 @@ reg_t kEmptyList(EngineState *s, int argc, reg_t *argv) {
List *l = lookup_list(s, argv[0]);
if (!l || !sane_listp(s, argv[0]))
- error("List at %04x:%04x is invalid or not sane anymore", PRINT_REG(argv[0]));
+ warning("List at %04x:%04x is invalid or not sane anymore", PRINT_REG(argv[0]));
return make_reg(0, ((l) ? l->first.isNull() : 0));
}
@@ -238,7 +238,7 @@ void _k_add_to_front(EngineState *s, reg_t listbase, reg_t nodebase) {
if (!new_n)
warning("Attempt to add non-node (%04x:%04x) to list at %04x:%04x", PRINT_REG(nodebase), PRINT_REG(listbase));
if (!l || !sane_listp(s, listbase))
- error("List at %04x:%04x is not sane anymore", PRINT_REG(listbase));
+ warning("List at %04x:%04x is not sane anymore", PRINT_REG(listbase));
new_n->succ = l->first;
new_n->pred = NULL_REG;
@@ -262,7 +262,7 @@ void _k_add_to_end(EngineState *s, reg_t listbase, reg_t nodebase) {
if (!new_n)
warning("Attempt to add non-node (%04x:%04x) to list at %04x:%04x", PRINT_REG(nodebase), PRINT_REG(listbase));
if (!l || !sane_listp(s, listbase))
- error("List at %04x:%04x is not sane anymore", PRINT_REG(listbase));
+ warning("List at %04x:%04x is not sane anymore", PRINT_REG(listbase));
new_n->succ = NULL_REG;
new_n->pred = l->last;
@@ -279,7 +279,7 @@ void _k_add_to_end(EngineState *s, reg_t listbase, reg_t nodebase) {
reg_t kNextNode(EngineState *s, int argc, reg_t *argv) {
Node *n = lookup_node(s, argv[0]);
if (!sane_nodep(s, argv[0])) {
- error("List node at %04x:%04x is not sane anymore", PRINT_REG(argv[0]));
+ warning("List node at %04x:%04x is not sane anymore", PRINT_REG(argv[0]));
return NULL_REG;
}
@@ -289,7 +289,7 @@ reg_t kNextNode(EngineState *s, int argc, reg_t *argv) {
reg_t kPrevNode(EngineState *s, int argc, reg_t *argv) {
Node *n = lookup_node(s, argv[0]);
if (!sane_nodep(s, argv[0]))
- error("List node at %04x:%04x is not sane anymore", PRINT_REG(argv[0]));
+ warning("List node at %04x:%04x is not sane anymore", PRINT_REG(argv[0]));
return n->pred;
}
@@ -297,7 +297,7 @@ reg_t kPrevNode(EngineState *s, int argc, reg_t *argv) {
reg_t kNodeValue(EngineState *s, int argc, reg_t *argv) {
Node *n = lookup_node(s, argv[0]);
if (!sane_nodep(s, argv[0])) {
- error("List node at %04x:%04x is not sane", PRINT_REG(argv[0]));
+ warning("List node at %04x:%04x is not sane", PRINT_REG(argv[0]));
return NULL_REG;
}
@@ -315,7 +315,7 @@ reg_t kAddAfter(EngineState *s, int argc, reg_t *argv) {
Node *newnode = lookup_node(s, argv[2]);
if (!l || !sane_listp(s, argv[0]))
- error("List at %04x:%04x is not sane anymore", PRINT_REG(argv[0]));
+ warning("List at %04x:%04x is not sane anymore", PRINT_REG(argv[0]));
// FIXME: This should be an error, but it's turned to a warning for now
if (!newnode) {
@@ -361,7 +361,7 @@ reg_t kFindKey(EngineState *s, int argc, reg_t *argv) {
debugC(2, kDebugLevelNodes, "Looking for key %04x:%04x in list %04x:%04x\n", PRINT_REG(key), PRINT_REG(list_pos));
if (!sane_listp(s, list_pos))
- error("List at %04x:%04x is not sane anymore", PRINT_REG(list_pos));
+ warning("List at %04x:%04x is not sane anymore", PRINT_REG(list_pos));
node_pos = lookup_list(s, list_pos)->first;