mirror of https://github.com/OpenTTD/OpenTTD.git
Cleanup: nested_array should not be accessed directly.
Replace accesses with GetWidget() as documented.
This commit is contained in:
parent
c811d42d0c
commit
7385e780ac
|
@ -485,7 +485,7 @@ public:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WID_AP_AIRPORT_LIST: {
|
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;
|
if (num_clicked >= this->vscroll->GetCount()) break;
|
||||||
const AirportSpec *as = AirportClass::Get(_selected_airport_class)->GetSpec(num_clicked);
|
const AirportSpec *as = AirportClass::Get(_selected_airport_class)->GetSpec(num_clicked);
|
||||||
if (as->IsAvailable()) this->SelectOtherAirport(num_clicked);
|
if (as->IsAvailable()) this->SelectOtherAirport(num_clicked);
|
||||||
|
|
|
@ -1046,7 +1046,7 @@ struct DepotWindow : Window {
|
||||||
this->RaiseWidget(WID_D_SELL);
|
this->RaiseWidget(WID_D_SELL);
|
||||||
this->SetWidgetDirty(WID_D_SELL);
|
this->SetWidgetDirty(WID_D_SELL);
|
||||||
}
|
}
|
||||||
if (this->nested_array[WID_D_SELL] != nullptr && !this->IsWidgetDisabled(WID_D_SELL_CHAIN)) {
|
if (this->GetWidget<NWidgetBase>(WID_D_SELL) != nullptr && !this->IsWidgetDisabled(WID_D_SELL_CHAIN)) {
|
||||||
this->RaiseWidget(WID_D_SELL_CHAIN);
|
this->RaiseWidget(WID_D_SELL_CHAIN);
|
||||||
this->SetWidgetDirty(WID_D_SELL_CHAIN);
|
this->SetWidgetDirty(WID_D_SELL_CHAIN);
|
||||||
}
|
}
|
||||||
|
|
|
@ -515,7 +515,7 @@ public:
|
||||||
{
|
{
|
||||||
switch (GB(widget, 0, 16)) {
|
switch (GB(widget, 0, 16)) {
|
||||||
case WID_BO_CLASS_LIST: {
|
case WID_BO_CLASS_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 >= (int)this->object_classes.size()) break;
|
if (num_clicked >= (int)this->object_classes.size()) break;
|
||||||
|
|
||||||
this->SelectOtherClass(this->object_classes[num_clicked]);
|
this->SelectOtherClass(this->object_classes[num_clicked]);
|
||||||
|
|
Loading…
Reference in New Issue