aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoseph-Eugene Winzer2017-06-16 10:25:41 +0200
committerThierry Crozat2018-01-22 23:08:39 +0000
commitf2e51c3cfe0a6c1ae2794d5eee54dba4da0ba201 (patch)
treea8411f441dafc5700cbde301b609f9c363669ca0
parentf4eb7cbfc5ad4d3c266406b2f93748365df9be95 (diff)
downloadscummvm-rg350-f2e51c3cfe0a6c1ae2794d5eee54dba4da0ba201.tar.gz
scummvm-rg350-f2e51c3cfe0a6c1ae2794d5eee54dba4da0ba201.tar.bz2
scummvm-rg350-f2e51c3cfe0a6c1ae2794d5eee54dba4da0ba201.zip
SUPERNOVA: Adds hasProperty() for Objects and bit ops
-rw-r--r--engines/supernova/msn_def.h6
-rw-r--r--engines/supernova/supernova.cpp8
2 files changed, 14 insertions, 0 deletions
diff --git a/engines/supernova/msn_def.h b/engines/supernova/msn_def.h
index 1bd81ddc0f..d19dd1ed6a 100644
--- a/engines/supernova/msn_def.h
+++ b/engines/supernova/msn_def.h
@@ -371,8 +371,10 @@ enum ObjectID {
};
ObjectType operator|(ObjectType a, ObjectType b);
+ObjectType operator&(ObjectType a, ObjectType b);
ObjectType operator^(ObjectType a, ObjectType b);
ObjectType &operator|=(ObjectType &a, ObjectType b);
+ObjectType &operator&=(ObjectType &a, ObjectType b);
ObjectType &operator^=(ObjectType &a, ObjectType b);
struct Object {
@@ -410,6 +412,10 @@ struct Object {
_type ^= type;
}
+ bool hasProperty(ObjectType type) const {
+ return _type & type;
+ }
+
const char *_name;
const char *_description;
ObjectID _id;
diff --git a/engines/supernova/supernova.cpp b/engines/supernova/supernova.cpp
index a24af84aca..6bd50f9572 100644
--- a/engines/supernova/supernova.cpp
+++ b/engines/supernova/supernova.cpp
@@ -47,6 +47,10 @@ ObjectType operator|(ObjectType a, ObjectType b) {
return static_cast<ObjectType>(+a | +b);
}
+ObjectType operator&(ObjectType a, ObjectType b) {
+ return static_cast<ObjectType>(+a & +b);
+}
+
ObjectType operator^(ObjectType a, ObjectType b) {
return static_cast<ObjectType>(+a ^ +b);
}
@@ -55,6 +59,10 @@ ObjectType &operator|=(ObjectType &a, ObjectType b) {
return a = a | b;
}
+ObjectType &operator&=(ObjectType &a, ObjectType b) {
+ return a = a & b;
+}
+
ObjectType &operator^=(ObjectType &a, ObjectType b) {
return a = a ^ b;
}