Codechange: Use begin/end of nwidget parts of begin/length.
This simplifies processing nwidget parts as, unlike the remaining length, the pointer to the end of the list never changes. This is the same principle as we use(d) for tracking end instead of length for C-style strings. And this removes 160~ instances of the lengthof() macro.
This commit is contained in:
@@ -330,7 +330,7 @@ static WindowDesc _town_authority_desc(
|
||||
WDP_AUTO, "view_town_authority", 317, 222,
|
||||
WC_TOWN_AUTHORITY, WC_NONE,
|
||||
0,
|
||||
_nested_town_authority_widgets, lengthof(_nested_town_authority_widgets)
|
||||
std::begin(_nested_town_authority_widgets), std::end(_nested_town_authority_widgets)
|
||||
);
|
||||
|
||||
static void ShowTownAuthorityWindow(uint town)
|
||||
@@ -631,7 +631,7 @@ static WindowDesc _town_game_view_desc(
|
||||
WDP_AUTO, "view_town", 260, TownViewWindow::WID_TV_HEIGHT_NORMAL,
|
||||
WC_TOWN_VIEW, WC_NONE,
|
||||
0,
|
||||
_nested_town_game_view_widgets, lengthof(_nested_town_game_view_widgets)
|
||||
std::begin(_nested_town_game_view_widgets), std::end(_nested_town_game_view_widgets)
|
||||
);
|
||||
|
||||
static const NWidgetPart _nested_town_editor_view_widgets[] = {
|
||||
@@ -662,7 +662,7 @@ static WindowDesc _town_editor_view_desc(
|
||||
WDP_AUTO, "view_town_scen", 260, TownViewWindow::WID_TV_HEIGHT_NORMAL,
|
||||
WC_TOWN_VIEW, WC_NONE,
|
||||
0,
|
||||
_nested_town_editor_view_widgets, lengthof(_nested_town_editor_view_widgets)
|
||||
std::begin(_nested_town_editor_view_widgets), std::end(_nested_town_editor_view_widgets)
|
||||
);
|
||||
|
||||
void ShowTownViewWindow(TownID town)
|
||||
@@ -1037,7 +1037,7 @@ static WindowDesc _town_directory_desc(
|
||||
WDP_AUTO, "list_towns", 208, 202,
|
||||
WC_TOWN_DIRECTORY, WC_NONE,
|
||||
0,
|
||||
_nested_town_directory_widgets, lengthof(_nested_town_directory_widgets)
|
||||
std::begin(_nested_town_directory_widgets), std::end(_nested_town_directory_widgets)
|
||||
);
|
||||
|
||||
void ShowTownDirectory()
|
||||
@@ -1287,7 +1287,7 @@ static WindowDesc _found_town_desc(
|
||||
WDP_AUTO, "build_town", 160, 162,
|
||||
WC_FOUND_TOWN, WC_NONE,
|
||||
WDF_CONSTRUCTION,
|
||||
_nested_found_town_widgets, lengthof(_nested_found_town_widgets)
|
||||
std::begin(_nested_found_town_widgets), std::end(_nested_found_town_widgets)
|
||||
);
|
||||
|
||||
void ShowFoundTownWindow()
|
||||
|
||||
Reference in New Issue
Block a user