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

@@ -97,7 +97,7 @@ struct WindowDesc : ZeroedMemoryAllocator {
WindowDesc(WindowPosition default_pos, const char *ini_key, int16_t def_width_trad, int16_t def_height_trad,
WindowClass window_class, WindowClass parent_class, uint32_t flags,
const NWidgetPart *nwid_parts, int16_t nwid_length, HotkeyList *hotkeys = nullptr);
const NWidgetPart *nwid_begin, const NWidgetPart *nwid_end, HotkeyList *hotkeys = nullptr);
~WindowDesc();
@@ -106,8 +106,8 @@ struct WindowDesc : ZeroedMemoryAllocator {
WindowClass parent_cls; ///< Class of the parent window. @see WindowClass
const char *ini_key; ///< Key to store window defaults in openttd.cfg. \c nullptr if nothing shall be stored.
uint32_t flags; ///< Flags. @see WindowDefaultFlag
const NWidgetPart *nwid_parts; ///< Nested widget parts describing the window.
int16_t nwid_length; ///< Length of the #nwid_parts array.
const NWidgetPart *nwid_begin; ///< Beginning of nested widget parts describing the window.
const NWidgetPart *nwid_end; ///< Ending of nested widget parts describing the window.
HotkeyList *hotkeys; ///< Hotkeys for the window.
bool pref_sticky; ///< Preferred stickyness.