From b5483a6aadb498657ec0ebb54ac125be596ca054 Mon Sep 17 00:00:00 2001 From: Kirill Diduk Date: Sun, 17 Jul 2022 19:12:51 +0200 Subject: [PATCH] [GDNative] Expose `Dictionary::merge()` over to GDNative CORE API v1.3 --- modules/gdnative/gdnative/dictionary.cpp | 8 ++++++++ modules/gdnative/gdnative_api.json | 9 +++++++++ modules/gdnative/include/gdnative/dictionary.h | 4 ++++ 3 files changed, 21 insertions(+) diff --git a/modules/gdnative/gdnative/dictionary.cpp b/modules/gdnative/gdnative/dictionary.cpp index c3d428d69b8..08fbb28687c 100644 --- a/modules/gdnative/gdnative/dictionary.cpp +++ b/modules/gdnative/gdnative/dictionary.cpp @@ -186,6 +186,14 @@ godot_variant GDAPI godot_dictionary_get_with_default(const godot_dictionary *p_ return raw_dest; } +// GDNative core 1.3 + +void GDAPI godot_dictionary_merge(godot_dictionary *p_self, const godot_dictionary *p_dictionary, const godot_bool p_overwrite) { + Dictionary *self = (Dictionary *)p_self; + const Dictionary *dictionary = (const Dictionary *)p_dictionary; + self->merge(*dictionary, p_overwrite); +} + #ifdef __cplusplus } #endif diff --git a/modules/gdnative/gdnative_api.json b/modules/gdnative/gdnative_api.json index 9f90743f94f..c065dafb535 100644 --- a/modules/gdnative/gdnative_api.json +++ b/modules/gdnative/gdnative_api.json @@ -25,6 +25,15 @@ }, "next": null, "api": [ + { + "name": "godot_dictionary_merge", + "return_type": "void", + "arguments": [ + ["godot_dictionary *", "p_self"], + ["const godot_dictionary *", "p_dictionary"], + ["const godot_bool", "p_overwrite"] + ] + }, { "name": "godot_pool_byte_array_has", "return_type": "godot_bool", diff --git a/modules/gdnative/include/gdnative/dictionary.h b/modules/gdnative/include/gdnative/dictionary.h index 6e8d5116884..1a7411ec140 100644 --- a/modules/gdnative/include/gdnative/dictionary.h +++ b/modules/gdnative/include/gdnative/dictionary.h @@ -102,6 +102,10 @@ godot_bool GDAPI godot_dictionary_erase_with_return(godot_dictionary *p_self, co godot_variant GDAPI godot_dictionary_get_with_default(const godot_dictionary *p_self, const godot_variant *p_key, const godot_variant *p_default); +// GDNative core 1.3 + +void GDAPI godot_dictionary_merge(godot_dictionary *p_self, const godot_dictionary *p_dictionary, const godot_bool p_overwrite); + #ifdef __cplusplus } #endif