Skip to content

Commit

Permalink
Codechange: Replace game options' style-breaking if-condition with sw…
Browse files Browse the repository at this point in the history
…itch.
  • Loading branch information
PeterN committed Jan 14, 2024
1 parent 341d022 commit 8ca867e
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/settings_gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down

0 comments on commit 8ca867e

Please sign in to comment.