Codechange: Replace game options' style-breaking if-condition with switch.

This commit is contained in:
Peter Nelson 2024-01-14 10:48:19 +00:00 committed by Peter Nelson
parent 341d022024
commit 8ca867ef63
1 changed files with 8 additions and 3 deletions

View File

@ -390,9 +390,14 @@ struct GameOptionsWindow : Window {
this->LowerWidget(widget);
GameOptionsWindow::active_tab = widget;
int pane = 0;
if (widget == WID_GO_TAB_GRAPHICS) pane = 1;
else if (widget == WID_GO_TAB_SOUND) pane = 2;
int pane;
switch (widget) {
case WID_GO_TAB_GENERAL: pane = 0; break;
case WID_GO_TAB_GRAPHICS: pane = 1; break;
case WID_GO_TAB_SOUND: pane = 2; break;
default: NOT_REACHED();
}
this->GetWidget<NWidgetStacked>(WID_GO_TAB_SELECTION)->SetDisplayedPlane(pane);
this->SetDirty();
}