summaryrefslogtreecommitdiffstats
path: root/include/godot_cpp
diff options
context:
space:
mode:
authorbruvzg <7645683+bruvzg@users.noreply.github.com>2022-03-16 20:33:06 +0200
committerbruvzg <7645683+bruvzg@users.noreply.github.com>2022-03-16 20:33:06 +0200
commit93de1b2b0b742cac4263f3b6da8fa5ec0224779a (patch)
treea2d6500b31f7dd491bb09cb3e8bfdaac68b9d549 /include/godot_cpp
parent7bcf579a377bbfb87a67acdfc08696f7cb429bc2 (diff)
downloadredot-cpp-93de1b2b0b742cac4263f3b6da8fa5ec0224779a.tar.gz
Sync godot-headers and fix build after "Create GDExtension clases for PhysicsServer3D".
Diffstat (limited to 'include/godot_cpp')
-rw-r--r--include/godot_cpp/core/object.hpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/include/godot_cpp/core/object.hpp b/include/godot_cpp/core/object.hpp
index 129fcf3..fb8974d 100644
--- a/include/godot_cpp/core/object.hpp
+++ b/include/godot_cpp/core/object.hpp
@@ -134,6 +134,28 @@ MethodInfo::MethodInfo(const PropertyInfo &p_ret, const char *p_name, const Args
arguments = { args... };
}
+class ObjectID {
+ uint64_t id = 0;
+
+public:
+ _FORCE_INLINE_ bool is_ref_counted() const { return (id & (uint64_t(1) << 63)) != 0; }
+ _FORCE_INLINE_ bool is_valid() const { return id != 0; }
+ _FORCE_INLINE_ bool is_null() const { return id == 0; }
+ _FORCE_INLINE_ operator uint64_t() const { return id; }
+ _FORCE_INLINE_ operator int64_t() const { return id; }
+
+ _FORCE_INLINE_ bool operator==(const ObjectID &p_id) const { return id == p_id.id; }
+ _FORCE_INLINE_ bool operator!=(const ObjectID &p_id) const { return id != p_id.id; }
+ _FORCE_INLINE_ bool operator<(const ObjectID &p_id) const { return id < p_id.id; }
+
+ _FORCE_INLINE_ void operator=(int64_t p_int64) { id = p_int64; }
+ _FORCE_INLINE_ void operator=(uint64_t p_uint64) { id = p_uint64; }
+
+ _FORCE_INLINE_ ObjectID() {}
+ _FORCE_INLINE_ explicit ObjectID(const uint64_t p_id) { id = p_id; }
+ _FORCE_INLINE_ explicit ObjectID(const int64_t p_id) { id = p_id; }
+};
+
class ObjectDB {
public:
static Object *get_instance(uint64_t p_object_id) {