Dictionary: remove erase_checked(key), make erase(key) return bool
This commit is contained in:
parent
a71a5fc0c3
commit
21d285e30f
|
@ -135,12 +135,7 @@ bool Dictionary::has_all(const Array &p_keys) const {
|
|||
return true;
|
||||
}
|
||||
|
||||
void Dictionary::erase(const Variant &p_key) {
|
||||
|
||||
_p->variant_map.erase(p_key);
|
||||
}
|
||||
|
||||
bool Dictionary::erase_checked(const Variant &p_key) {
|
||||
bool Dictionary::erase(const Variant &p_key) {
|
||||
|
||||
return _p->variant_map.erase(p_key);
|
||||
}
|
||||
|
|
|
@ -65,8 +65,7 @@ public:
|
|||
bool has(const Variant &p_key) const;
|
||||
bool has_all(const Array &p_keys) const;
|
||||
|
||||
void erase(const Variant &p_key);
|
||||
bool erase_checked(const Variant &p_key);
|
||||
bool erase(const Variant &p_key);
|
||||
|
||||
bool operator==(const Dictionary &p_dictionary) const;
|
||||
|
||||
|
|
|
@ -1649,7 +1649,7 @@ void register_variant_methods() {
|
|||
ADDFUNC0NC(DICTIONARY, NIL, Dictionary, clear, varray());
|
||||
ADDFUNC1R(DICTIONARY, BOOL, Dictionary, has, NIL, "key", varray());
|
||||
ADDFUNC1R(DICTIONARY, BOOL, Dictionary, has_all, ARRAY, "keys", varray());
|
||||
ADDFUNC1(DICTIONARY, NIL, Dictionary, erase, NIL, "key", varray());
|
||||
ADDFUNC1R(DICTIONARY, BOOL, Dictionary, erase, NIL, "key", varray());
|
||||
ADDFUNC0R(DICTIONARY, INT, Dictionary, hash, varray());
|
||||
ADDFUNC0R(DICTIONARY, ARRAY, Dictionary, keys, varray());
|
||||
ADDFUNC0R(DICTIONARY, ARRAY, Dictionary, values, varray());
|
||||
|
|
|
@ -182,7 +182,7 @@ bool godot_icall_Dictionary_ContainsKey(Dictionary *ptr, MonoObject *key) {
|
|||
}
|
||||
|
||||
bool godot_icall_Dictionary_RemoveKey(Dictionary *ptr, MonoObject *key) {
|
||||
return ptr->erase_checked(GDMonoMarshal::mono_object_to_variant(key));
|
||||
return ptr->erase(GDMonoMarshal::mono_object_to_variant(key));
|
||||
}
|
||||
|
||||
bool godot_icall_Dictionary_Remove(Dictionary *ptr, MonoObject *key, MonoObject *value) {
|
||||
|
@ -191,7 +191,7 @@ bool godot_icall_Dictionary_Remove(Dictionary *ptr, MonoObject *key, MonoObject
|
|||
// no dupes
|
||||
Variant *ret = ptr->getptr(varKey);
|
||||
if (ret != NULL && *ret == GDMonoMarshal::mono_object_to_variant(value)) {
|
||||
ptr->erase_checked(varKey);
|
||||
ptr->erase(varKey);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue