summaryrefslogtreecommitdiffstats
path: root/core/variant.cpp
diff options
context:
space:
mode:
authorJuan Linietsky <juan@godotengine.org>2020-02-12 14:24:06 -0300
committerJuan Linietsky <juan@godotengine.org>2020-02-12 14:24:54 -0300
commitcf8c679a23b21d6c6f29cba6a54eaa2eed88bf92 (patch)
tree52aca947b395362b2addec4843915b15947c32ca /core/variant.cpp
parent4aa31a2851e3dd5b67193194f899850239b2669d (diff)
downloadredot-engine-cf8c679a23b21d6c6f29cba6a54eaa2eed88bf92.tar.gz
ObjectID converted to a structure, fixes many bugs where used incorrectly as 32 bits.
Diffstat (limited to 'core/variant.cpp')
-rw-r--r--core/variant.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/core/variant.cpp b/core/variant.cpp
index f4e4cd5341..0f04710d13 100644
--- a/core/variant.cpp
+++ b/core/variant.cpp
@@ -1248,6 +1248,14 @@ Variant::operator uint64_t() const {
}
}
+Variant::operator ObjectID() const {
+ if (type == INT) {
+ return ObjectID(_data._int);
+ } else {
+ return ObjectID();
+ }
+}
+
#ifdef NEED_LONG_INT
Variant::operator signed long() const {
@@ -2193,6 +2201,11 @@ Variant::Variant(double p_double) {
_data._real = p_double;
}
+Variant::Variant(const ObjectID &p_id) {
+ type = INT;
+ _data._int = p_id;
+}
+
Variant::Variant(const StringName &p_string) {
type = STRING;