Changeset - r28442:ae8df033a6f2
[Not reviewed]
master
0 1 0
Peter Nelson - 11 months ago 2024-01-14 10:48:19
peter1138@openttd.org
Codechange: Replace game options' style-breaking if-condition with switch.
1 file changed with 8 insertions and 3 deletions:
0 comments (0 inline, 0 general)
src/settings_gui.cpp
Show inline comments
 
@@ -387,15 +387,20 @@ struct GameOptionsWindow : Window {
 
	void SetTab(WidgetID widget)
 
	{
 
		this->SetWidgetsLoweredState(false, WID_GO_TAB_GENERAL, WID_GO_TAB_GRAPHICS, WID_GO_TAB_SOUND);
 
		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();
 
	}
 

	
 
	void OnResize() override
 
	{
0 comments (0 inline, 0 general)