Fix #11261: Set number of items correctly when choosing available airport set (#11344)

This commit is contained in:
merni-ns 2023-10-03 16:28:44 +05:30 committed by GitHub
parent 82c8720814
commit 077b08bbfa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -544,13 +544,14 @@ public:
} }
if (change_class) { if (change_class) {
/* If that fails, select the first available airport /* If that fails, select the first available airport
* from a random class. */ * from the first class where airports are available. */
for (AirportClassID j = APC_BEGIN; j < APC_MAX; j++) { for (AirportClassID j = APC_BEGIN; j < APC_MAX; j++) {
AirportClass *apclass = AirportClass::Get(j); AirportClass *apclass = AirportClass::Get(j);
for (uint i = 0; i < apclass->GetSpecCount(); i++) { for (uint i = 0; i < apclass->GetSpecCount(); i++) {
const AirportSpec *as = apclass->GetSpec(i); const AirportSpec *as = apclass->GetSpec(i);
if (as->IsAvailable()) { if (as->IsAvailable()) {
_selected_airport_class = j; _selected_airport_class = j;
this->vscroll->SetCount(apclass->GetSpecCount());
this->SelectOtherAirport(i); this->SelectOtherAirport(i);
return; return;
} }