summaryrefslogtreecommitdiff
path: root/src/group_gui.cpp
diff options
context:
space:
mode:
authorPeter Nelson <peter1138@openttd.org>2019-01-27 12:35:14 +0000
committerNiels Martin Hansen <nielsm@indvikleren.dk>2019-01-28 20:29:43 +0100
commit310fa1af8863d84f9ebbe6b5ea36c21f3c4a43cf (patch)
treefcb4b19f292a63425ce5b1f64a953710525802d2 /src/group_gui.cpp
parentfe37b40385afa809f2c1bb5971b833e314fd1e32 (diff)
downloadopenttd-310fa1af8863d84f9ebbe6b5ea36c21f3c4a43cf.tar.xz
Codechange: Rename function to match what it does and reduce code indenting.
Diffstat (limited to 'src/group_gui.cpp')
-rw-r--r--src/group_gui.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/group_gui.cpp b/src/group_gui.cpp
index 811b46af8..a88492084 100644
--- a/src/group_gui.cpp
+++ b/src/group_gui.cpp
@@ -122,14 +122,13 @@ private:
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 @@ private:
list.ForceResort();
list.Sort(&GroupNameSorter);
- AddParents(&list, INVALID_GROUP, 0);
+ AddChildren(&list, INVALID_GROUP, 0);
this->groups.Compact();
this->groups.RebuildDone();