summaryrefslogtreecommitdiff
path: root/core/variant/dictionary.cpp
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2022-06-06 23:38:29 +0200
committerGitHub <noreply@github.com>2022-06-06 23:38:29 +0200
commit83421cd06f8aeacc69d666e0e695333fdaa80377 (patch)
tree58a9c005ef6f029f8884120a4f1b6dee5bb9b008 /core/variant/dictionary.cpp
parent8fb004efbc6161d2adec9501c08cfc9a910086f6 (diff)
parenta0915e6dee4e54563a98ca6adb8968dbdcea1af1 (diff)
Merge pull request #59883 from KoBeWi/merge_this
Diffstat (limited to 'core/variant/dictionary.cpp')
-rw-r--r--core/variant/dictionary.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/core/variant/dictionary.cpp b/core/variant/dictionary.cpp
index bda8c93a79..822021f440 100644
--- a/core/variant/dictionary.cpp
+++ b/core/variant/dictionary.cpp
@@ -269,6 +269,14 @@ void Dictionary::clear() {
_p->variant_map.clear();
}
+void Dictionary::merge(const Dictionary &p_dictionary, bool p_overwrite) {
+ for (const KeyValue<Variant, Variant> &E : p_dictionary._p->variant_map) {
+ if (p_overwrite || !has(E.key)) {
+ this->operator[](E.key) = E.value;
+ }
+ }
+}
+
void Dictionary::_unref() const {
ERR_FAIL_COND(!_p);
if (_p->refcount.unref()) {