Codechange: add and use SetSprite over directly accessing widget_data

This commit is contained in:
Rubidium
2025-01-02 12:51:56 +01:00
committed by rubidium42
parent 9ac1bad480
commit fb06ddafba
8 changed files with 43 additions and 33 deletions
+2 -2
View File
@@ -3069,7 +3069,7 @@ public:
SPR_SEND_AIRCRAFT_TODEPOT,
};
const Vehicle *v = Vehicle::Get(window_number);
this->GetWidget<NWidgetCore>(WID_VV_GOTO_DEPOT)->widget_data = vehicle_view_goto_depot_sprites[v->type];
this->GetWidget<NWidgetCore>(WID_VV_GOTO_DEPOT)->SetSprite(vehicle_view_goto_depot_sprites[v->type]);
/* Sprites for the 'clone vehicle' button indexed by vehicle type. */
static const SpriteID vehicle_view_clone_sprites[] = {
@@ -3078,7 +3078,7 @@ public:
SPR_CLONE_SHIP,
SPR_CLONE_AIRCRAFT,
};
this->GetWidget<NWidgetCore>(WID_VV_CLONE)->widget_data = vehicle_view_clone_sprites[v->type];
this->GetWidget<NWidgetCore>(WID_VV_CLONE)->SetSprite(vehicle_view_clone_sprites[v->type]);
switch (v->type) {
case VEH_TRAIN: