Codechange: Use std::map to provide indexed widget access.

This removes the need to determine the biggest widget index and replaces C-style memory handling.
This commit is contained in:
Peter Nelson
2023-10-16 11:13:36 +01:00
committed by Peter Nelson
parent a12f426d69
commit b86182ab84
16 changed files with 147 additions and 209 deletions

View File

@@ -1942,12 +1942,12 @@ static const NWidgetPart _nested_smallmap_bar[] = {
EndContainer(),
};
static NWidgetBase *SmallMapDisplay(int *biggest_index)
static NWidgetBase *SmallMapDisplay()
{
NWidgetContainer *map_display = new NWidgetSmallmapDisplay;
MakeNWidgets(std::begin(_nested_smallmap_display), std::end(_nested_smallmap_display), biggest_index, map_display);
MakeNWidgets(std::begin(_nested_smallmap_bar), std::end(_nested_smallmap_bar), biggest_index, map_display);
MakeNWidgets(std::begin(_nested_smallmap_display), std::end(_nested_smallmap_display), map_display);
MakeNWidgets(std::begin(_nested_smallmap_bar), std::end(_nested_smallmap_bar), map_display);
return map_display;
}