diff options
author | Emmanuel Leblond <emmanuel.leblond@gmail.com> | 2021-11-02 00:00:38 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-02 00:00:38 +0100 |
commit | 795cd2eb38626970e7487fcc0686b33c19fd6ab5 (patch) | |
tree | 84166ca907363cd1d8b8ec503cfe98e431909df4 /core/variant/variant_setget.cpp | |
parent | 7b83039885d2d3051726f93760d3f8f2a617b8f2 (diff) | |
parent | ce47ce8efba7d17c96ff7cc308c1cdbaa3965143 (diff) | |
download | redot-engine-795cd2eb38626970e7487fcc0686b33c19fd6ab5.tar.gz |
Merge pull request #35816 from touilleMan/dictionary-operator==-true-comparison
Modify Array/Dictionary::operator== to do real key/value comparison
Diffstat (limited to 'core/variant/variant_setget.cpp')
-rw-r--r-- | core/variant/variant_setget.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/core/variant/variant_setget.cpp b/core/variant/variant_setget.cpp index 4abb51ca7c..2530d77c62 100644 --- a/core/variant/variant_setget.cpp +++ b/core/variant/variant_setget.cpp @@ -1824,11 +1824,15 @@ Variant Variant::iter_get(const Variant &r_iter, bool &r_valid) const { return Variant(); } -Variant Variant::duplicate(bool deep) const { +Variant Variant::duplicate(bool p_deep) const { + return recursive_duplicate(p_deep, 0); +} + +Variant Variant::recursive_duplicate(bool p_deep, int recursion_count) const { switch (type) { case OBJECT: { /* breaks stuff :( - if (deep && !_get_obj().ref.is_null()) { + if (p_deep && !_get_obj().ref.is_null()) { Ref<Resource> resource = _get_obj().ref; if (resource.is_valid()) { return resource->duplicate(true); @@ -1838,9 +1842,9 @@ Variant Variant::duplicate(bool deep) const { return *this; } break; case DICTIONARY: - return operator Dictionary().duplicate(deep); + return operator Dictionary().recursive_duplicate(p_deep, recursion_count); case ARRAY: - return operator Array().duplicate(deep); + return operator Array().recursive_duplicate(p_deep, recursion_count); case PACKED_BYTE_ARRAY: return operator Vector<uint8_t>().duplicate(); case PACKED_INT32_ARRAY: |