Codechange: explicitly initialise member variables of Windows

This commit is contained in:
Rubidium
2025-02-22 20:52:38 +01:00
committed by rubidium42
parent 8813a798e7
commit fd8c33d051
8 changed files with 74 additions and 84 deletions

View File

@@ -742,20 +742,20 @@ static void DrawVehicleRefitWindow(const RefitOptions &refits, const RefitOption
/** Refit cargo window. */
struct RefitWindow : public Window {
const RefitOption *selected_refit; ///< Selected refit option.
RefitOptions refit_list; ///< List of refit subtypes available for each sorted cargo.
VehicleOrderID order; ///< If not #INVALID_VEH_ORDER_ID, selection is part of a refit order (rather than execute directly).
uint information_width; ///< Width required for correctly displaying all cargoes in the information panel.
Scrollbar *vscroll; ///< The main scrollbar.
Scrollbar *hscroll; ///< Only used for long vehicles.
int vehicle_width; ///< Width of the vehicle being drawn.
int sprite_left; ///< Left position of the vehicle sprite.
int sprite_right; ///< Right position of the vehicle sprite.
uint vehicle_margin; ///< Margin to use while selecting vehicles when the vehicle image is centered.
int click_x; ///< Position of the first click while dragging.
VehicleID selected_vehicle; ///< First vehicle in the current selection.
uint8_t num_vehicles; ///< Number of selected vehicles.
bool auto_refit; ///< Select cargo for auto-refitting.
const RefitOption *selected_refit = nullptr; ///< Selected refit option.
RefitOptions refit_list{}; ///< List of refit subtypes available for each sorted cargo.
VehicleOrderID order = INVALID_VEH_ORDER_ID; ///< If not #INVALID_VEH_ORDER_ID, selection is part of a refit order (rather than execute directly).
uint information_width = 0; ///< Width required for correctly displaying all cargoes in the information panel.
Scrollbar *vscroll = nullptr; ///< The main scrollbar.
Scrollbar *hscroll = nullptr; ///< Only used for long vehicles.
int vehicle_width = 0; ///< Width of the vehicle being drawn.
int sprite_left = 0; ///< Left position of the vehicle sprite.
int sprite_right = 0; ///< Right position of the vehicle sprite.
uint vehicle_margin = 0; ///< Margin to use while selecting vehicles when the vehicle image is centered.
int click_x = 0; ///< Position of the first click while dragging.
VehicleID selected_vehicle{}; ///< First vehicle in the current selection.
uint8_t num_vehicles = 0; ///< Number of selected vehicles.
bool auto_refit = false; ///< Select cargo for auto-refitting.
/**
* Collects all (cargo, subcargo) refit options of a vehicle chain.
@@ -2091,7 +2091,7 @@ public:
this->DrawWidgets();
}
bool last_overlay_state;
bool last_overlay_state = false;
void OnMouseLoop() override
{
if (last_overlay_state != ShowCargoIconOverlay()) {
@@ -2416,8 +2416,8 @@ static StringID _service_interval_dropdown_wallclock[] = {
/** Class for managing the vehicle details window. */
struct VehicleDetailsWindow : Window {
TrainDetailsWindowTabs tab; ///< For train vehicles: which tab is displayed.
Scrollbar *vscroll;
TrainDetailsWindowTabs tab = TDW_TAB_CARGO; ///< For train vehicles: which tab is displayed.
Scrollbar *vscroll = nullptr;
/** Initialize a newly created vehicle details window */
VehicleDetailsWindow(WindowDesc &desc, WindowNumber window_number) : Window(desc)
@@ -2429,7 +2429,6 @@ struct VehicleDetailsWindow : Window {
this->FinishInitNested(window_number);
this->owner = v->owner;
this->tab = TDW_TAB_CARGO;
}
/**