From 310fa1af8863d84f9ebbe6b5ea36c21f3c4a43cf Mon Sep 17 00:00:00 2001 From: Peter Nelson Date: Sun, 27 Jan 2019 12:35:14 +0000 Subject: [PATCH] Codechange: Rename function to match what it does and reduce code indenting. --- src/group_gui.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/group_gui.cpp b/src/group_gui.cpp index 811b46af8eaa1..a884920842533 100644 --- a/src/group_gui.cpp +++ b/src/group_gui.cpp @@ -122,14 +122,13 @@ class VehicleGroupWindow : public BaseVehicleListWindow { Dimension column_size[VGC_END]; ///< Size of the columns in the group list. - void AddParents(GUIGroupList *source, GroupID parent, int indent) + void AddChildren(GUIGroupList *source, GroupID parent, int indent) { for (const Group **g = source->Begin(); g != source->End(); g++) { - if ((*g)->parent == parent) { - *this->groups.Append() = *g; - *this->indents.Append() = indent; - AddParents(source, (*g)->index, indent + 1); - } + if ((*g)->parent != parent) continue; + *this->groups.Append() = *g; + *this->indents.Append() = indent; + AddChildren(source, (*g)->index, indent + 1); } } @@ -180,7 +179,7 @@ class VehicleGroupWindow : public BaseVehicleListWindow { list.ForceResort(); list.Sort(&GroupNameSorter); - AddParents(&list, INVALID_GROUP, 0); + AddChildren(&list, INVALID_GROUP, 0); this->groups.Compact(); this->groups.RebuildDone();