# HG changeset patch # User Peter Nelson # Date 2024-01-14 10:48:19 # Node ID ae8df033a6f23d686aa6a4a54ff352ac21c2c2a8 # Parent 638e7fa75a043c465555315cb7ccd7892507d1db Codechange: Replace game options' style-breaking if-condition with switch. diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp --- a/src/settings_gui.cpp +++ b/src/settings_gui.cpp @@ -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(WID_GO_TAB_SELECTION)->SetDisplayedPlane(pane); this->SetDirty(); }