diff options
author | Max Horn | 2009-05-06 11:07:04 +0000 |
---|---|---|
committer | Max Horn | 2009-05-06 11:07:04 +0000 |
commit | 8d2f80fd51dd84db8f4e5aadb887def9920226e8 (patch) | |
tree | e37666660921b021dbc9b9cc17345390b65fc4f0 /engines/sci/engine | |
parent | b7d1ca00d72aae402f23ac0c1519f4b41bfdd69f (diff) | |
download | scummvm-rg350-8d2f80fd51dd84db8f4e5aadb887def9920226e8.tar.gz scummvm-rg350-8d2f80fd51dd84db8f4e5aadb887def9920226e8.tar.bz2 scummvm-rg350-8d2f80fd51dd84db8f4e5aadb887def9920226e8.zip |
SCI: Added operator== and !=, as well as an isNull method to reg_t
svn-id: r40356
Diffstat (limited to 'engines/sci/engine')
-rw-r--r-- | engines/sci/engine/vm.cpp | 2 | ||||
-rw-r--r-- | engines/sci/engine/vm_types.h | 17 |
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 |