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:
@@ -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 */
|
||||
|
||||
Reference in New Issue
Block a user