Codechange: Add constant for INVALID_WIDGET. (#14649)

Replaces direct use of -1, making it easier to find.
This commit is contained in:
Peter Nelson
2025-09-21 22:47:04 +01:00
committed by dP
parent 18bf0e2b58
commit 1824e42246
19 changed files with 35 additions and 44 deletions

View File

@@ -240,7 +240,7 @@ struct DepotWindow : Window {
VehicleType type = VEH_INVALID;
bool generate_list = true;
bool check_unitnumber_digits = true;
WidgetID hovered_widget = -1; ///< Index of the widget being hovered during drag/drop. -1 if no drag is in progress.
WidgetID hovered_widget = INVALID_WIDGET; ///< Index of the widget being hovered during drag/drop. \c INVALID_WIDGET if no drag is in progress.
VehicleList vehicle_list{};
VehicleList wagon_list{};
uint unitnumber_digits = 2;
@@ -989,10 +989,10 @@ struct DepotWindow : Window {
this->vehicle_over = VehicleID::Invalid();
this->SetWidgetDirty(WID_D_MATRIX);
if (this->hovered_widget != -1) {
if (this->hovered_widget != INVALID_WIDGET) {
this->SetWidgetLoweredState(this->hovered_widget, false);
this->SetWidgetDirty(this->hovered_widget);
this->hovered_widget = -1;
this->hovered_widget = INVALID_WIDGET;
}
}
@@ -1104,7 +1104,7 @@ struct DepotWindow : Window {
this->SetDirty();
break;
}
this->hovered_widget = -1;
this->hovered_widget = INVALID_WIDGET;
_cursor.vehchain = false;
}