diff options
author | Andrii Doroshenko (Xrayez) <xrayez@gmail.com> | 2019-10-23 21:48:48 +0300 |
---|---|---|
committer | Andrii Doroshenko (Xrayez) <xrayez@gmail.com> | 2019-10-24 14:45:04 +0300 |
commit | 1b9a7e1c21856a76a6a723734191296d347dd520 (patch) | |
tree | 49144184fa4fbd1c4acdb25dc110c806c3fb30ed | |
parent | 9008cc486e28553ff8ea07639245efedcf545be2 (diff) |
Fix `inst2dict` calling to getters to retrieve value
Use `GDScriptInstance` to iterate through all members directly instead.
This is similar to how `dict2inst` works and makes the serialization
behaviour more consistent.
-rw-r--r-- | modules/gdscript/gdscript_functions.cpp | 20 |
1 files changed, 3 insertions, 17 deletions
diff --git a/modules/gdscript/gdscript_functions.cpp b/modules/gdscript/gdscript_functions.cpp index d9535d0f1f..1d6562e69d 100644 --- a/modules/gdscript/gdscript_functions.cpp +++ b/modules/gdscript/gdscript_functions.cpp @@ -1127,25 +1127,11 @@ void GDScriptFunctions::call(Function p_func, const Variant **p_args, int p_arg_ d["@subpath"] = cp; d["@path"] = p->path; - p = base.ptr(); - - while (p) { - - for (Set<StringName>::Element *E = p->members.front(); E; E = E->next()) { - - Variant value; - if (ins->get(E->get(), value)) { - - String k = E->get(); - if (!d.has(k)) { - d[k] = value; - } - } + for (Map<StringName, GDScript::MemberInfo>::Element *E = base->member_indices.front(); E; E = E->next()) { + if (!d.has(E->key())) { + d[E->key()] = ins->members[E->get().index]; } - - p = p->_base; } - r_ret = d; } } |