Add recursive comparison to Array and Dictionary

...and expose it to GDScript.

Co-authored-by: Emmanuel Leblond <emmanuel.leblond@gmail.com>
This commit is contained in:
Pedro J. Estébanez
2020-10-07 19:23:06 +02:00
parent 1f8497d281
commit a7aad78fd0
11 changed files with 118 additions and 1 deletions

View File

@ -213,8 +213,12 @@ public:
(*list_element)->get().second = p_value;
return Element(*list_element);
}
typename InternalList::Element *new_element = list.push_back(Pair<const K *, V>(NULL, p_value));
// Incorrectly set the first value of the pair with a value that will
// be invalid as soon as we leave this function...
typename InternalList::Element *new_element = list.push_back(Pair<const K *, V>(&p_key, p_value));
// ...this is needed here in case the hashmap recursively reference itself...
typename InternalMap::Element *e = map.set(p_key, new_element);
// ...now we can set the right value !
new_element->get().first = &e->key();
return Element(new_element);