Codechange: Replace mishmash of types for widget index with WidgetID.

Indices were stored as int, but often passed around as uint/uint8_t and casts.

Now they should all use WidgetID.
This commit is contained in:
Peter Nelson
2023-12-29 19:11:59 +00:00
committed by Peter Nelson
parent fd84f73323
commit a0dfb76e34
77 changed files with 666 additions and 657 deletions

View File

@@ -65,7 +65,7 @@ struct SetDateWindow : Window {
* Helper function to construct the dropdown.
* @param widget the dropdown widget to create the dropdown for
*/
void ShowDateDropDown(int widget)
void ShowDateDropDown(WidgetID widget)
{
int selected;
DropDownList list;
@@ -99,7 +99,7 @@ struct SetDateWindow : Window {
ShowDropDownList(this, std::move(list), selected, widget);
}
void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override
void UpdateWidgetSize(WidgetID widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override
{
Dimension d = {0, 0};
switch (widget) {
@@ -128,7 +128,7 @@ struct SetDateWindow : Window {
*size = d;
}
void SetStringParameters(int widget) const override
void SetStringParameters(WidgetID widget) const override
{
switch (widget) {
case WID_SD_DAY: SetDParam(0, this->date.day - 1 + STR_DAY_NUMBER_1ST); break;
@@ -137,7 +137,7 @@ struct SetDateWindow : Window {
}
}
void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override
void OnClick([[maybe_unused]] Point pt, WidgetID widget, [[maybe_unused]] int click_count) override
{
switch (widget) {
case WID_SD_DAY:
@@ -153,7 +153,7 @@ struct SetDateWindow : Window {
}
}
void OnDropdownSelect(int widget, int index) override
void OnDropdownSelect(WidgetID widget, int index) override
{
switch (widget) {
case WID_SD_DAY: