shithub: choc

Download patch

ref: fcc629e8552a63e623bb6c43c48dc379fa7490bb
parent: a98d35b8ef7f57839e0f321d4c68918279bc854a
author: Simon Howard <fraggle@soulsphere.org>
date: Sat Jun 4 20:16:03 EDT 2016

setup: Use TXT_If() for display settings.

Simplification of more code.

--- a/src/setup/display.c
+++ b/src/setup/display.c
@@ -221,26 +221,17 @@
     TXT_SetColumnWidths(window, 35);
 
     TXT_AddWidgets(window,
-                   ar_checkbox = TXT_NewCheckBox("Fix aspect ratio",
-                                                 &aspect_ratio_correct),
-                   NULL);
-
-    if (gamemission == heretic || gamemission == hexen || gamemission == strife)
-    {
-        TXT_AddWidget(window,
-                      TXT_NewCheckBox("Graphical startup", &graphical_startup));
-    }
-
-    if (gamemission == doom || gamemission == heretic || gamemission == strife)
-    {
-        TXT_AddWidget(window,
-                      TXT_NewCheckBox("Show ENDOOM screen on exit",
-                                      &show_endoom));
-    }
-
-    TXT_AddWidget(window,
-                  TXT_NewCheckBox("Save screenshots in PNG format",
-                                  &png_screenshots));
+        ar_checkbox = TXT_NewCheckBox("Fix aspect ratio",
+                                      &aspect_ratio_correct),
+        TXT_If(gamemission == heretic || gamemission == hexen
+            || gamemission == strife,
+            TXT_NewCheckBox("Graphical startup", &graphical_startup)),
+        TXT_If(gamemission == doom || gamemission == heretic
+            || gamemission == strife,
+            TXT_NewCheckBox("Show ENDOOM screen on exit",
+                            &show_endoom)),
+        TXT_NewCheckBox("Save screenshots in PNG format",
+                        &png_screenshots));
 
     TXT_SignalConnect(ar_checkbox, "changed", GenerateModesTable, modes_table);
 }