Docs: Fix order of variant constants.

(cherry picked from commit 409562558a)
This commit is contained in:
bruvzg 2020-05-20 16:45:42 +03:00 committed by Rémi Verschelde
parent 66e00a2670
commit c4e652a6a3
1 changed files with 11 additions and 0 deletions

View File

@ -1061,6 +1061,9 @@ struct _VariantCall {
List<StringName> value_ordered; List<StringName> value_ordered;
#endif #endif
Map<StringName, Variant> variant_value; Map<StringName, Variant> variant_value;
#ifdef DEBUG_ENABLED
List<StringName> variant_value_ordered;
#endif
}; };
static ConstantData *constant_data; static ConstantData *constant_data;
@ -1076,6 +1079,9 @@ struct _VariantCall {
static void add_variant_constant(int p_type, StringName p_constant_name, const Variant &p_constant_value) { static void add_variant_constant(int p_type, StringName p_constant_name, const Variant &p_constant_value) {
constant_data[p_type].variant_value[p_constant_name] = p_constant_value; constant_data[p_type].variant_value[p_constant_name] = p_constant_value;
#ifdef DEBUG_ENABLED
constant_data[p_type].variant_value_ordered.push_back(p_constant_name);
#endif
} }
}; };
@ -1441,9 +1447,14 @@ void Variant::get_constants_for_type(Variant::Type p_type, List<StringName> *p_c
#endif #endif
} }
#ifdef DEBUG_ENABLED
for (List<StringName>::Element *E = cd.variant_value_ordered.front(); E; E = E->next()) {
p_constants->push_back(E->get());
#else
for (Map<StringName, Variant>::Element *E = cd.variant_value.front(); E; E = E->next()) { for (Map<StringName, Variant>::Element *E = cd.variant_value.front(); E; E = E->next()) {
p_constants->push_back(E->key()); p_constants->push_back(E->key());
#endif
} }
} }