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

@@ -89,28 +89,28 @@ static WindowDesc _train_depot_desc(
WDP_AUTO, "depot_train", 362, 123,
WC_VEHICLE_DEPOT, WC_NONE,
0,
_nested_train_depot_widgets, lengthof(_nested_train_depot_widgets)
std::begin(_nested_train_depot_widgets), std::end(_nested_train_depot_widgets)
);
static WindowDesc _road_depot_desc(
WDP_AUTO, "depot_roadveh", 316, 97,
WC_VEHICLE_DEPOT, WC_NONE,
0,
_nested_train_depot_widgets, lengthof(_nested_train_depot_widgets)
std::begin(_nested_train_depot_widgets), std::end(_nested_train_depot_widgets)
);
static WindowDesc _ship_depot_desc(
WDP_AUTO, "depot_ship", 306, 99,
WC_VEHICLE_DEPOT, WC_NONE,
0,
_nested_train_depot_widgets, lengthof(_nested_train_depot_widgets)
std::begin(_nested_train_depot_widgets), std::end(_nested_train_depot_widgets)
);
static WindowDesc _aircraft_depot_desc(
WDP_AUTO, "depot_aircraft", 332, 99,
WC_VEHICLE_DEPOT, WC_NONE,
0,
_nested_train_depot_widgets, lengthof(_nested_train_depot_widgets)
std::begin(_nested_train_depot_widgets), std::end(_nested_train_depot_widgets)
);
extern void DepotSortList(VehicleList *list);