Codechange: Use single list for hierarchical group lists. (#12330)

Replace both group list implementations (vehicle group list and company colour group list) with a single implementation, using a struct to hold the group and indentation level instead of two separate lists. Parts that were previously duplicated are now shared.
This commit is contained in:
Peter Nelson
2024-03-18 17:49:51 +00:00
committed by GitHub
parent ec3c8d3462
commit 107c208d87
3 changed files with 116 additions and 130 deletions

View File

@@ -17,4 +17,15 @@ void ShowCompanyGroup(CompanyID company, VehicleType veh, GroupID group = INVALI
void ShowCompanyGroupForVehicle(const Vehicle *v);
void DeleteGroupHighlightOfVehicle(const Vehicle *v);
struct GUIGroupListItem {
const Group *group;
int8_t indent; ///< Display indentation level.
constexpr GUIGroupListItem(const Group *group, int8_t indent) : group(group), indent(indent) {}
};
using GUIGroupList = GUIList<GUIGroupListItem>;
void BuildGuiGroupList(GUIGroupList &dst, bool fold, Owner owner, VehicleType veh_type);
#endif /* GROUP_GUI_H */