Cleanup: nested_array should not be accessed directly.

Replace accesses with GetWidget() as documented.
This commit is contained in:
Peter Nelson
2021-04-29 20:04:50 +01:00
committed by PeterN
parent c811d42d0c
commit 7385e780ac
3 changed files with 3 additions and 3 deletions

View File

@@ -485,7 +485,7 @@ public:
break;
case WID_AP_AIRPORT_LIST: {
int num_clicked = this->vscroll->GetPosition() + (pt.y - this->nested_array[widget]->pos_y) / this->line_height;
int num_clicked = this->vscroll->GetPosition() + (pt.y - this->GetWidget<NWidgetBase>(widget)->pos_y) / this->line_height;
if (num_clicked >= this->vscroll->GetCount()) break;
const AirportSpec *as = AirportClass::Get(_selected_airport_class)->GetSpec(num_clicked);
if (as->IsAvailable()) this->SelectOtherAirport(num_clicked);