[Scummvm-cvs-logs] SF.net SVN: scummvm:[40356] scummvm/trunk/engines/sci/engine

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Wed May 6 13:07:04 CEST 2009


Revision: 40356
          http://scummvm.svn.sourceforge.net/scummvm/?rev=40356&view=rev
Author:   fingolfin
Date:     2009-05-06 11:07:04 +0000 (Wed, 06 May 2009)

Log Message:
-----------
SCI: Added operator== and !=, as well as an isNull method to reg_t

Modified Paths:
--------------
    scummvm/trunk/engines/sci/engine/vm.cpp
    scummvm/trunk/engines/sci/engine/vm_types.h

Modified: scummvm/trunk/engines/sci/engine/vm.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/vm.cpp	2009-05-06 11:06:43 UTC (rev 40355)
+++ scummvm/trunk/engines/sci/engine/vm.cpp	2009-05-06 11:07:04 UTC (rev 40356)
@@ -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

Modified: scummvm/trunk/engines/sci/engine/vm_types.h
===================================================================
--- scummvm/trunk/engines/sci/engine/vm_types.h	2009-05-06 11:06:43 UTC (rev 40355)
+++ scummvm/trunk/engines/sci/engine/vm_types.h	2009-05-06 11:07:04 UTC (rev 40356)
@@ -36,6 +36,18 @@
 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 @@
 	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


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list