aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/engine
diff options
context:
space:
mode:
Diffstat (limited to 'engines/sci/engine')
-rw-r--r--engines/sci/engine/vm.cpp2
-rw-r--r--engines/sci/engine/vm_types.h17
2 files changed, 15 insertions, 4 deletions
diff --git a/engines/sci/engine/vm.cpp b/engines/sci/engine/vm.cpp
index 7f997d62d3..65c3b6f5c2 100644
--- a/engines/sci/engine/vm.cpp
+++ b/engines/sci/engine/vm.cpp
@@ -39,7 +39,7 @@
namespace Sci {
-reg_t NULL_REG = NULL_REG_INITIALIZER;
+reg_t NULL_REG = {0, 0};
//#define VM_DEBUG_SEND
#undef STRICT_SEND // Disallows variable sends with more than one parameter
diff --git a/engines/sci/engine/vm_types.h b/engines/sci/engine/vm_types.h
index 46b34bfeef..7412532a3b 100644
--- a/engines/sci/engine/vm_types.h
+++ b/engines/sci/engine/vm_types.h
@@ -36,6 +36,18 @@ typedef int SegmentId;
struct reg_t {
uint16 segment;
uint16 offset;
+
+ bool isNull() const {
+ return !(offset || segment);
+ }
+
+ bool operator==(const reg_t &x) const {
+ return (offset == x.offset) && (segment == x.segment);
+ }
+
+ bool operator!=(const reg_t &x) const {
+ return (offset != x.offset) || (segment != x.segment);
+ }
};
#define PREG "%04x:%04x"
@@ -61,9 +73,8 @@ static inline reg_t make_reg(int segment, int offset) {
return r;
}
-#define IS_NULL_REG(r) (!((r).offset || (r).segment))
-#define REG_EQ(a, b) (((a).offset == (b).offset) && ((a).segment == (b).segment))
-#define NULL_REG_INITIALIZER {0, 0}
+#define IS_NULL_REG(r) ((r).isNull())
+#define REG_EQ(a, b) ((a) == (b))
extern reg_t NULL_REG;
} // End of namespace Sci