]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/menu/xonotic/checkbox.qc
take3: format 903 files
[xonotic/xonotic-data.pk3dir.git] / qcsrc / menu / xonotic / checkbox.qc
index 949b01c41da50c353beb177a70991d4683f28741..29f372cce1a20bc6d4058153515d238e271585a4 100644 (file)
@@ -3,23 +3,16 @@
 entity makeXonoticCheckBox_T(float isInverted, string theCvar, string theText, string theTooltip)
 {
        float m, n;
-       if(isInverted > 1)
-       {
+       if (isInverted > 1) {
                n = isInverted - 1;
                m = -n;
-       }
-       else if(isInverted < -1)
-       {
+       } else if (isInverted < -1) {
                n = isInverted + 1;
                m = -n;
-       }
-       else if(isInverted == 1)
-       {
+       } else if (isInverted == 1) {
                n = 1;
                m = 0;
-       }
-       else
-       {
+       } else {
                n = 0;
                m = 1;
        }
@@ -54,20 +47,21 @@ void XonoticCheckBox_configureXonoticCheckBox(entity me, float theYesValue, floa
 }
 void XonoticCheckBox_setChecked(entity me, float val)
 {
-       if(val != me.checked)
-       {
+       if (val != me.checked) {
                me.checked = val;
                me.saveCvars(me);
-               if(me.linkedCheckBox)
+               if (me.linkedCheckBox) {
                        me.linkedCheckBox.loadCvars(me.linkedCheckBox);
+               }
        }
 }
 void XonoticCheckBox_loadCvars(entity me)
 {
        float m, d;
 
-       if (!me.cvarName)
+       if (!me.cvarName) {
                return;
+       }
 
        m = (me.yesValue + me.noValue) * 0.5;
        d = (cvar(me.cvarName) - m) / (me.yesValue - m);
@@ -75,13 +69,15 @@ void XonoticCheckBox_loadCvars(entity me)
 }
 void XonoticCheckBox_saveCvars(entity me)
 {
-       if (!me.cvarName)
+       if (!me.cvarName) {
                return;
+       }
 
-       if(me.checked)
+       if (me.checked) {
                cvar_set(me.cvarName, ftos_mindecimals(me.yesValue));
-       else
+       } else {
                cvar_set(me.cvarName, ftos_mindecimals(me.noValue));
+       }
 
        CheckSendCvars(me, me.cvarName);
 }