From 8ca867ef63b9c2d64589da0a750b487ee91ac7f6 Mon Sep 17 00:00:00 2001 From: Peter Nelson Date: Sun, 14 Jan 2024 10:48:19 +0000 Subject: [PATCH] Codechange: Replace game options' style-breaking if-condition with switch. --- src/settings_gui.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp index ffe8beb6bf..8fd9b6e569 100644 --- 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(); }