1
0
Fork 0

Codechange: Use range-for to iterate airport specs to find first available.

pull/12869/head
Peter Nelson 2024-07-17 10:04:59 +01:00 committed by Peter Nelson
parent 2199543fbc
commit 7fb3d1a197
1 changed files with 2 additions and 3 deletions

View File

@ -537,10 +537,9 @@ public:
{ {
/* First try to select an airport in the selected class. */ /* First try to select an airport in the selected class. */
AirportClass *sel_apclass = AirportClass::Get(_selected_airport_class); AirportClass *sel_apclass = AirportClass::Get(_selected_airport_class);
for (uint i = 0; i < sel_apclass->GetSpecCount(); i++) { for (const AirportSpec *as : sel_apclass->Specs()) {
const AirportSpec *as = sel_apclass->GetSpec(i);
if (as->IsAvailable()) { if (as->IsAvailable()) {
this->SelectOtherAirport(i); this->SelectOtherAirport(as->index);
return; return;
} }
} }