aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Horn2009-05-18 15:07:31 +0000
committerMax Horn2009-05-18 15:07:31 +0000
commit790e235ae17382b70f4a90f7a6fa931fde476a64 (patch)
tree111b52efb76b757e5de719c160caefb17a9d349c
parent9da07f21fe5edf8e3820a25f488a12491ccfc9d3 (diff)
downloadscummvm-rg350-790e235ae17382b70f4a90f7a6fa931fde476a64.tar.gz
scummvm-rg350-790e235ae17382b70f4a90f7a6fa931fde476a64.tar.bz2
scummvm-rg350-790e235ae17382b70f4a90f7a6fa931fde476a64.zip
SCI: Removed ENTRY_IS_VALID macro
svn-id: r40690
-rw-r--r--engines/sci/engine/kernel.cpp10
-rw-r--r--engines/sci/engine/klists.cpp4
-rw-r--r--engines/sci/engine/sciconsole.cpp2
-rw-r--r--engines/sci/engine/scriptdebug.cpp10
-rw-r--r--engines/sci/engine/seg_manager.cpp2
-rw-r--r--engines/sci/engine/vm.h3
6 files changed, 14 insertions, 17 deletions
diff --git a/engines/sci/engine/kernel.cpp b/engines/sci/engine/kernel.cpp
index 831a7a2d6f..cb89e04f9f 100644
--- a/engines/sci/engine/kernel.cpp
+++ b/engines/sci/engine/kernel.cpp
@@ -240,8 +240,8 @@ bool has_kernel_function(EngineState *s, const char *kname) {
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)) {
- error("Error: kmem() with invalid handle\n");
+ if (!ht || !ht->isValidEntry(handle.offset)) {
+ warning("Error: kmem() with invalid handle\n");
return NULL;
}
@@ -669,7 +669,7 @@ int determine_reg_type(EngineState *s, reg_t reg, int allow_invalid) {
return KSIG_REF;
case MEM_OBJ_CLONES:
- if (allow_invalid || ENTRY_IS_VALID((CloneTable *)mobj, reg.offset))
+ if (allow_invalid || ((CloneTable *)mobj)->isValidEntry(reg.offset))
return KSIG_OBJECT;
else
return KSIG_OBJECT | KSIG_INVALID;
@@ -694,13 +694,13 @@ int determine_reg_type(EngineState *s, reg_t reg, int allow_invalid) {
return KSIG_REF | KSIG_INVALID;
case MEM_OBJ_LISTS:
- if (allow_invalid || ENTRY_IS_VALID((ListTable *)mobj, reg.offset))
+ if (allow_invalid || ((ListTable *)mobj)->isValidEntry(reg.offset))
return KSIG_LIST;
else
return KSIG_LIST | KSIG_INVALID;
case MEM_OBJ_NODES:
- if (allow_invalid || ENTRY_IS_VALID((NodeTable *)mobj, reg.offset))
+ if (allow_invalid || ((NodeTable *)mobj)->isValidEntry(reg.offset))
return KSIG_NODE;
else
return KSIG_NODE | KSIG_INVALID;
diff --git a/engines/sci/engine/klists.cpp b/engines/sci/engine/klists.cpp
index 57b25abff5..af5bfb0d8a 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 (!ENTRY_IS_VALID(nt, addr.offset)) {
+ if (!nt->isValidEntry(addr.offset)) {
sciprintf("Attempt to use non-node "PREG" as list node\n", PRINT_REG(addr));
script_debug_flag = script_error_flag = 1;
return NULL;
@@ -64,7 +64,7 @@ List *lookup_list(EngineState *s, reg_t addr) {
ListTable *lt = (ListTable *)mobj;
- if (!ENTRY_IS_VALID(lt, addr.offset)) {
+ if (!lt->isValidEntry(addr.offset)) {
sciprintf("Attempt to use non-list "PREG" as list\n", PRINT_REG(addr));
script_debug_flag = script_error_flag = 1;
return NULL;
diff --git a/engines/sci/engine/sciconsole.cpp b/engines/sci/engine/sciconsole.cpp
index 3cdb6a1768..7bbe5f83c4 100644
--- a/engines/sci/engine/sciconsole.cpp
+++ b/engines/sci/engine/sciconsole.cpp
@@ -203,7 +203,7 @@ void con_init() {
}
static inline int clone_is_used(CloneTable *t, int idx) {
- return ENTRY_IS_VALID(t, idx);
+ return t->isValidEntry(idx);
}
int parse_reg_t(EngineState *s, const char *str, reg_t *dest) { // Returns 0 on success
diff --git a/engines/sci/engine/scriptdebug.cpp b/engines/sci/engine/scriptdebug.cpp
index 9fa313238d..6da40fc09d 100644
--- a/engines/sci/engine/scriptdebug.cpp
+++ b/engines/sci/engine/scriptdebug.cpp
@@ -354,15 +354,15 @@ static void print_list(EngineState *s, List *l) {
while (!IS_NULL_REG(pos)) {
Node *node;
- MemObject *mobj = GET_SEGMENT(*s->seg_manager, pos.segment, MEM_OBJ_NODES);
+ NodeTable *nt = (NodeTable *)GET_SEGMENT(*s->seg_manager, pos.segment, MEM_OBJ_NODES);
- if (!mobj || !ENTRY_IS_VALID((NodeTable *)mobj, pos.offset)) {
+ if (!nt || !nt->isValidEntry(pos.offset)) {
sciprintf(" WARNING: "PREG": Doesn't contain list node!\n",
PRINT_REG(pos));
return;
}
- node = &((*(NodeTable *)mobj)._table[pos.offset]);
+ node = &(nt->_table[pos.offset]);
sciprintf("\t"PREG" : "PREG" -> "PREG"\n", PRINT_REG(pos), PRINT_REG(node->key), PRINT_REG(node->value));
@@ -499,7 +499,7 @@ static int show_node(EngineState *s, reg_t addr) {
ListTable *lt = (ListTable *)mobj;
List *list;
- if (!ENTRY_IS_VALID(lt, addr.offset)) {
+ if (!lt->isValidEntry(addr.offset)) {
sciprintf("Address does not contain a list\n");
return 1;
}
@@ -519,7 +519,7 @@ static int show_node(EngineState *s, reg_t addr) {
nt = (NodeTable *)mobj;
- if (!ENTRY_IS_VALID(nt, addr.offset)) {
+ if (!nt->isValidEntry(addr.offset)) {
sciprintf("Address does not contain a node\n");
return 1;
}
diff --git a/engines/sci/engine/seg_manager.cpp b/engines/sci/engine/seg_manager.cpp
index 610cd86d31..f55cad20c1 100644
--- a/engines/sci/engine/seg_manager.cpp
+++ b/engines/sci/engine/seg_manager.cpp
@@ -1106,7 +1106,7 @@ void CloneTable::listAllOutgoingReferences(EngineState *s, reg_t addr, void *par
// assert(addr.segment == _segId);
- if (!(ENTRY_IS_VALID(clone_table, addr.offset))) {
+ if (!clone_table->isValidEntry(addr.offset)) {
fprintf(stderr, "Unexpected request for outgoing references from clone at "PREG"\n", PRINT_REG(addr));
// BREAKPOINT();
return;
diff --git a/engines/sci/engine/vm.h b/engines/sci/engine/vm.h
index 97ad7a758c..5b9c87decb 100644
--- a/engines/sci/engine/vm.h
+++ b/engines/sci/engine/vm.h
@@ -564,9 +564,6 @@ public:
// virtual void saveLoadWithSerializer(Common::Serializer &ser);
};
-// FIXME: Replace ENTRY_IS_VALID by a direct method call
-#define ENTRY_IS_VALID(t, i) ((t)->isValidEntry(i))
-
/* CloneTable */
struct CloneTable : public Table<Clone> {