]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Make sure all classes that control a cvar initialize cvarName to string_null in their...
authorterencehill <piuntn@gmail.com>
Sun, 30 Aug 2015 18:14:19 +0000 (20:14 +0200)
committerterencehill <piuntn@gmail.com>
Sun, 30 Aug 2015 18:14:19 +0000 (20:14 +0200)
qcsrc/menu/xonotic/checkbox.qc
qcsrc/menu/xonotic/checkbox_string.qc
qcsrc/menu/xonotic/colorpicker_string.qc
qcsrc/menu/xonotic/dialog_multiplayer_create.qc
qcsrc/menu/xonotic/gametypebutton.qc
qcsrc/menu/xonotic/inputbox.qc
qcsrc/menu/xonotic/radiobutton.qc
qcsrc/menu/xonotic/slider.qc
qcsrc/menu/xonotic/textslider.qc

index 88fbfaa2a77483aa58aedd8a47f1f17057f3ef24..bb63bffe43517679bd9bd279e398b64318aca232 100644 (file)
@@ -76,11 +76,8 @@ void XonoticCheckBox_configureXonoticCheckBox(entity me, float theYesValue, floa
        me.yesValue = theYesValue;
        me.noValue = theNoValue;
        me.checked = 0;
-       if(theCvar)
-       {
-               me.cvarName = theCvar;
-               me.loadCvars(me);
-       }
+       me.cvarName = (theCvar) ? theCvar : string_null;
+       me.loadCvars(me);
        setZonedTooltip(me, theTooltip, theCvar);
        me.configureCheckBox(me, theText, me.fontSize, me.image);
 }
index 15ee0921ec56a6ca94292438ac8252c18dd09932..a93c9acf5d666a56611e30b01eb5b8f7acb4b322 100644 (file)
@@ -38,11 +38,8 @@ void XonoticCheckBoxString_configureXonoticCheckBoxString(entity me, string theY
        me.yesString = theYesValue;
        me.noString = theNoValue;
        me.checked = 0;
-       if(theCvar)
-       {
-               me.cvarName = theCvar;
-               me.loadCvars(me);
-       }
+       me.cvarName = (theCvar) ? theCvar : string_null;
+       me.loadCvars(me);
        me.configureCheckBox(me, theText, me.fontSize, me.image);
 }
 void XonoticCheckBoxString_setChecked(entity me, float foo)
index fa830cd692dde51bb07b2428b412d683cd613969..c8c26e4f365da0d1a90a48fa00d6f00c3831e6f7 100644 (file)
@@ -33,11 +33,8 @@ entity makeXonoticColorpickerString(string theCvar, string theDefaultCvar)
 void XonoticColorpickerString_configureXonoticColorpickerString(entity me, string theCvar, string theDefaultCvar)
 {
        me.configureImage(me, me.image);
-       if(theCvar)
-       {
-               me.cvarName = theCvar;
-               me.loadCvars(me);
-       }
+       me.cvarName = (theCvar) ? theCvar : string_null;
+       me.loadCvars(me);
 }
 
 void XonoticColorpickerString_loadCvars(entity me)
index 61943306834959ccabb76577097e0af3b819ec0c..0c27210aa4a9bd41b458e189c69c25869b3de4a4 100644 (file)
@@ -25,7 +25,6 @@ void GameType_ConfigureSliders(entity e, entity l, string pLabel, float pMin, fl
 {
        if(pCvar == "")
        {
-               e.cvarName = string_null; // FIXME XonoticTextSlider doesn't clear cvarName in configureXonoticTextSlider as it's not thought to re-configure itself
                e.configureXonoticTextSlider(e, string_null, string_null);
                l.setText(l, pLabel);
                e.disabled = l.disabled = true;
@@ -246,8 +245,6 @@ void XonoticServerCreateTab_gameTypeChangeNotify(entity me)
                case MAPINFO_TYPE_KEYHUNT:          x = "g_keyhunt_teams_override";     break;
                case MAPINFO_TYPE_TEAM_DEATHMATCH:  x = "g_tdm_teams_override";         break;
        }
-       if(!x)
-               e.cvarName = string_null; // FIXME XonoticTextSlider doesn't clear cvarName in configureXonoticTextSlider as it's not thought to re-configure itself
        e.configureXonoticTextSlider(e, x, theTooltip);
        e.configureXonoticTextSliderValues(e);
        if(!x)
index 161c62bfcb620f9dba827a6b903e166bcf0115b3..fb80866903247d7b7e64321dfdd40aa3c394b59f 100644 (file)
@@ -34,11 +34,8 @@ entity makeXonoticGametypeButton(float theGroup, string theCvar, string theText)
 }
 void XonoticGametypeButton_configureXonoticGametypeButton(entity me, float theGroup, string theCvar, string theText, string theTooltip)
 {
-       if(theCvar)
-       {
-               me.cvarName = theCvar;
-               me.loadCvars(me);
-       }
+       me.cvarName = (theCvar) ? theCvar : string_null;
+       me.loadCvars(me);
        setZonedTooltip(me, theTooltip, theCvar);
        me.configureRadioButton(me, theText, me.fontSize, me.image, theGroup, 0);
        me.align = 0.5;
index c72339caf6e5b12dc6257f64b358c8c31353951d..6dc49c02ea7ec9df3c7d6e9437d0898b4acd0240 100644 (file)
@@ -53,11 +53,8 @@ void XonoticInputBox_configureXonoticInputBox(entity me, float doEditColorCodes,
 {
        me.configureInputBox(me, "", 0, me.fontSize, me.image);
        me.editColorCodes = doEditColorCodes;
-       if(theCvar)
-       {
-               me.cvarName = theCvar;
-               me.loadCvars(me);
-       }
+       me.cvarName = (theCvar) ? theCvar : string_null;
+       me.loadCvars(me);
        setZonedTooltip(me, theTooltip, theCvar);
        me.cursorPos = strlen(me.text);
 }
index 7e999392420a5ae283db81828e6aa8c9fd6eceea..27282207795580b122182c1b38c5c47546594d7f 100644 (file)
@@ -40,11 +40,8 @@ entity makeXonoticRadioButton(float theGroup, string theCvar, string theValue, s
 }
 void XonoticRadioButton_configureXonoticRadioButton(entity me, float theGroup, string theCvar, string theValue, string theText, string theTooltip)
 {
-       if(theCvar)
-       {
-               me.cvarName = theCvar;
-               me.loadCvars(me);
-       }
+       me.cvarName = (theCvar) ? theCvar : string_null;
+       me.loadCvars(me);
        setZonedTooltip(me, theTooltip, theCvar);
        me.configureRadioButton(me, theText, me.fontSize, me.image, theGroup, 0);
 }
index 1ffc7c987e48e6c43735a6264585c41c302cebfd..ca65c66218b12efe4561f37baa377e85e284edf4 100644 (file)
@@ -48,16 +48,14 @@ void XonoticSlider_configureXonoticSlider(entity me, float theValueMin, float th
 
        me.configureSliderVisuals(me, me.fontSize, me.align, me.valueSpace, me.image);
 
+       me.cvarName = (theCvar) ? theCvar : string_null;
        if(theCvar)
-       {
                // Prevent flickering of the slider button by initialising the
                // slider out of bounds to hide the button before loading the cvar
                me.configureSliderValues(me, theValueMin, theValueMin-theValueStep, theValueMax, theValueStep, theValueStep, vp);
-               me.cvarName = theCvar;
-               me.loadCvars(me);
-       }
        else
                me.configureSliderValues(me, theValueMin, theValueMin, theValueMax, theValueStep, theValueStep, vp);
+       me.loadCvars(me);
        setZonedTooltip(me, theTooltip, theCvar);
 }
 void XonoticSlider_setValue(entity me, float val)
index d55dfc6211528a2392702d89a2b35a501b66593f..597772e340019f4d58077158dc710b619e3b5944 100644 (file)
@@ -43,11 +43,8 @@ entity makeXonoticTextSlider(string theCvar)
 void XonoticTextSlider_configureXonoticTextSlider(entity me, string theCvar, string theTooltip)
 {
        me.configureSliderVisuals(me, me.fontSize, me.align, me.valueSpace, me.image);
-       if(theCvar)
-       {
-               me.cvarName = theCvar;
-               // me.loadCvars(me); // don't load it yet
-       }
+       me.cvarName = (theCvar) ? theCvar : string_null;
+       // me.loadCvars(me); // don't load it yet
        setZonedTooltip(me, theTooltip, theCvar);
 }
 void XonoticTextSlider_setValue(entity me, float val)