1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-01-24 20:54:08 +01:00

Codechange: add and use SetString over directly accessing widget_data

This commit is contained in:
Rubidium
2025-01-02 12:46:21 +01:00
committed by rubidium42
parent fb06ddafba
commit b60101853c
16 changed files with 74 additions and 42 deletions

View File

@@ -126,7 +126,7 @@ private:
this->bridges.Sort();
/* Display the current sort variant */
this->GetWidget<NWidgetCore>(WID_BBS_DROPDOWN_CRITERIA)->widget_data = BuildBridgeWindow::sorter_names[this->bridges.SortType()];
this->GetWidget<NWidgetCore>(WID_BBS_DROPDOWN_CRITERIA)->SetString(BuildBridgeWindow::sorter_names[this->bridges.SortType()]);
/* Set the modified widgets dirty */
this->SetWidgetDirty(WID_BBS_DROPDOWN_CRITERIA);
@@ -161,7 +161,7 @@ public:
this->CreateNestedTree();
this->vscroll = this->GetScrollbar(WID_BBS_SCROLLBAR);
/* Change the data, or the caption of the gui. Set it to road or rail, accordingly. */
this->GetWidget<NWidgetCore>(WID_BBS_CAPTION)->widget_data = (transport_type == TRANSPORT_ROAD) ? STR_SELECT_ROAD_BRIDGE_CAPTION : STR_SELECT_RAIL_BRIDGE_CAPTION;
this->GetWidget<NWidgetCore>(WID_BBS_CAPTION)->SetString((transport_type == TRANSPORT_ROAD) ? STR_SELECT_ROAD_BRIDGE_CAPTION : STR_SELECT_RAIL_BRIDGE_CAPTION);
this->FinishInitNested(transport_type); // Initializes 'this->icon_width'.
this->parent = FindWindowById(WC_BUILD_TOOLBAR, transport_type);