Autoreplace window: Don't scroll to selected engine if it isn't listed

See: https://github.com/OpenTTD/OpenTTD/issues/10554
pull/495/head
Jonathan G Rennison 1 year ago
parent 0fc9223724
commit 8002f023cb

@ -239,10 +239,12 @@ class ReplaceVehicleWindow : public Window {
if (this->reset_sel_engine && this->sel_engine[1] != INVALID_ENGINE) {
int position = 0;
for (const auto &item : this->engines[1]) {
if (item.engine_id == this->sel_engine[1]) break;
if (item.engine_id == this->sel_engine[1]) {
this->vscroll[1]->ScrollTowards(position);
break;
}
++position;
}
this->vscroll[1]->ScrollTowards(position);
}
}
}

Loading…
Cancel
Save