From c4e652a6a3f4e663fe784e457a8dea433019abb2 Mon Sep 17 00:00:00 2001 From: bruvzg <7645683+bruvzg@users.noreply.github.com> Date: Wed, 20 May 2020 16:45:42 +0300 Subject: [PATCH] Docs: Fix order of variant constants. (cherry picked from commit 409562558a1fc6f1978b083f94cb6d06bbc92664) --- core/variant_call.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/core/variant_call.cpp b/core/variant_call.cpp index 1ac55e85e3f..9e4b50e2439 100644 --- a/core/variant_call.cpp +++ b/core/variant_call.cpp @@ -1061,6 +1061,9 @@ struct _VariantCall { List value_ordered; #endif Map variant_value; +#ifdef DEBUG_ENABLED + List variant_value_ordered; +#endif }; 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) { 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 *p_c #endif } +#ifdef DEBUG_ENABLED + for (List::Element *E = cd.variant_value_ordered.front(); E; E = E->next()) { + p_constants->push_back(E->get()); +#else for (Map::Element *E = cd.variant_value.front(); E; E = E->next()) { p_constants->push_back(E->key()); +#endif } }