Skip to content

Commit

Permalink
Codechange: Rename function to match what it does and reduce code ind…
Browse files Browse the repository at this point in the history
…enting.
  • Loading branch information
PeterN authored and nielsmh committed Jan 28, 2019
1 parent fe37b40 commit 310fa1a
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/group_gui.cpp
Expand Up @@ -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);
}
}

Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit 310fa1a

Please sign in to comment.