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:
Peter Nelson
2023-09-03 21:54:13 +01:00
committed by PeterN
parent e4613fc04c
commit e8015e497d
65 changed files with 231 additions and 232 deletions

View File

@@ -43,7 +43,7 @@ static WindowDesc _background_desc(
WDP_MANUAL, nullptr, 0, 0,
WC_BOOTSTRAP, WC_NONE,
WDF_NO_CLOSE,
_background_widgets, lengthof(_background_widgets)
std::begin(_background_widgets), std::end(_background_widgets)
);
/** The background for the game. */
@@ -81,7 +81,7 @@ static WindowDesc _bootstrap_errmsg_desc(
WDP_CENTER, nullptr, 0, 0,
WC_BOOTSTRAP, WC_NONE,
WDF_MODAL | WDF_NO_CLOSE,
_nested_bootstrap_errmsg_widgets, lengthof(_nested_bootstrap_errmsg_widgets)
std::begin(_nested_bootstrap_errmsg_widgets), std::end(_nested_bootstrap_errmsg_widgets)
);
/** The window for a failed bootstrap. */
@@ -138,7 +138,7 @@ static WindowDesc _bootstrap_download_status_window_desc(
WDP_CENTER, nullptr, 0, 0,
WC_NETWORK_STATUS_WINDOW, WC_NONE,
WDF_MODAL | WDF_NO_CLOSE,
_nested_bootstrap_download_status_window_widgets, lengthof(_nested_bootstrap_download_status_window_widgets)
std::begin(_nested_bootstrap_download_status_window_widgets), std::end(_nested_bootstrap_download_status_window_widgets)
);
@@ -192,7 +192,7 @@ static WindowDesc _bootstrap_query_desc(
WDP_CENTER, nullptr, 0, 0,
WC_CONFIRM_POPUP_QUERY, WC_NONE,
WDF_NO_CLOSE,
_bootstrap_query_widgets, lengthof(_bootstrap_query_widgets)
std::begin(_bootstrap_query_widgets), std::end(_bootstrap_query_widgets)
);
/** The window for the query. It can't use the generic query window as that uses sprites that don't exist yet. */