Fix picker tool item selection in rail/road station and waypoint windows

This commit is contained in:
Jonathan G Rennison
2024-02-03 12:02:58 +00:00
parent 48c97d6cde
commit 7d92f185d3
3 changed files with 10 additions and 4 deletions

View File

@@ -1747,7 +1747,8 @@ public:
/* could not select class*/
return;
}
this->OnClick({}, WID_BROS_IMAGE | (spec_id << 16), 1);
this->GetWidget<NWidgetBase>(WID_BROS_IMAGE)->GetParentWidget<NWidgetMatrix>()->SetCurrentElement(spec_id);
this->OnClick({}, WID_BROS_IMAGE, 1);
}
static HotkeyList hotkeys;
@@ -2118,7 +2119,8 @@ struct BuildRoadWaypointWindow : PickerWindowBase {
{
for (uint i = 0; i < (uint)this->list.size(); i++) {
if (this->list[i] == spec_id) {
this->OnClick({}, WID_BROW_WAYPOINT | (i << 16), 1);
this->GetWidget<NWidgetBase>(WID_BROW_WAYPOINT)->GetParentWidget<NWidgetMatrix>()->SetCurrentElement(i);
this->OnClick({}, WID_BROW_WAYPOINT, 1);
break;
}
}