diff options
author | bruvzg <7645683+bruvzg@users.noreply.github.com> | 2022-06-06 12:19:56 +0300 |
---|---|---|
committer | bruvzg <7645683+bruvzg@users.noreply.github.com> | 2022-06-06 12:19:56 +0300 |
commit | b3bbf3db47b2bde688b013cb29f99e745313e2c5 (patch) | |
tree | 07ca2aa8758dbe28071438740d71cda209f1caa6 /core/extension | |
parent | 52952edafcbbc42185db8e5371119c1df9afca83 (diff) |
[GDExtension] Expose Variant, NodePath and StringName hash functions.
Diffstat (limited to 'core/extension')
-rw-r--r-- | core/extension/gdnative_interface.cpp | 12 | ||||
-rw-r--r-- | core/extension/gdnative_interface.h | 2 |
2 files changed, 14 insertions, 0 deletions
diff --git a/core/extension/gdnative_interface.cpp b/core/extension/gdnative_interface.cpp index a1d54f9c6d..58103e3af3 100644 --- a/core/extension/gdnative_interface.cpp +++ b/core/extension/gdnative_interface.cpp @@ -230,6 +230,16 @@ static void gdnative_variant_iter_get(const GDNativeVariantPtr p_self, GDNativeV } /// Variant functions. +static GDNativeInt gdnative_variant_hash(const GDNativeVariantPtr p_self) { + const Variant *self = (const Variant *)p_self; + return self->hash(); +} + +static GDNativeInt gdnative_variant_recursive_hash(const GDNativeVariantPtr p_self, GDNativeInt p_recursion_count) { + const Variant *self = (const Variant *)p_self; + return self->recursive_hash(p_recursion_count); +} + static GDNativeBool gdnative_variant_hash_compare(const GDNativeVariantPtr p_self, const GDNativeVariantPtr p_other) { const Variant *self = (const Variant *)p_self; const Variant *other = (const Variant *)p_other; @@ -944,6 +954,8 @@ void gdnative_setup_interface(GDNativeInterface *p_interface) { gdni.variant_iter_init = gdnative_variant_iter_init; gdni.variant_iter_next = gdnative_variant_iter_next; gdni.variant_iter_get = gdnative_variant_iter_get; + gdni.variant_hash = gdnative_variant_hash; + gdni.variant_recursive_hash = gdnative_variant_recursive_hash; gdni.variant_hash_compare = gdnative_variant_hash_compare; gdni.variant_booleanize = gdnative_variant_booleanize; gdni.variant_sub = gdnative_variant_sub; diff --git a/core/extension/gdnative_interface.h b/core/extension/gdnative_interface.h index 98976b29f6..095c7983ee 100644 --- a/core/extension/gdnative_interface.h +++ b/core/extension/gdnative_interface.h @@ -413,6 +413,8 @@ typedef struct { GDNativeBool (*variant_iter_init)(const GDNativeVariantPtr p_self, GDNativeVariantPtr r_iter, GDNativeBool *r_valid); GDNativeBool (*variant_iter_next)(const GDNativeVariantPtr p_self, GDNativeVariantPtr r_iter, GDNativeBool *r_valid); void (*variant_iter_get)(const GDNativeVariantPtr p_self, GDNativeVariantPtr r_iter, GDNativeVariantPtr r_ret, GDNativeBool *r_valid); + GDNativeInt (*variant_hash)(const GDNativeVariantPtr p_self); + GDNativeInt (*variant_recursive_hash)(const GDNativeVariantPtr p_self, GDNativeInt p_recursion_count); GDNativeBool (*variant_hash_compare)(const GDNativeVariantPtr p_self, const GDNativeVariantPtr p_other); GDNativeBool (*variant_booleanize)(const GDNativeVariantPtr p_self); void (*variant_sub)(const GDNativeVariantPtr p_a, const GDNativeVariantPtr p_b, GDNativeVariantPtr r_dst); |