]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/menu/xonotic/checkbox.c
Merge branch 'master' into samual/combined_updates
[xonotic/xonotic-data.pk3dir.git] / qcsrc / menu / xonotic / checkbox.c
index ad8216a9fe64c8b90c96229381692224dc369d0b..631a430dcc455947d8c63e83e0e24297ba5dd7ae 100644 (file)
@@ -15,6 +15,7 @@ CLASS(XonoticCheckBox) EXTENDS(CheckBox)
        ATTRIB(XonoticCheckBox, cvarName, string, string_null)
        METHOD(XonoticCheckBox, loadCvars, void(entity))
        METHOD(XonoticCheckBox, saveCvars, void(entity))
+       ATTRIB(XonoticCheckBox, sendCvars, float, 0)
 
        ATTRIB(XonoticCheckBox, alpha, float, SKINALPHA_TEXT)
        ATTRIB(XonoticCheckBox, disabledAlpha, float, SKINALPHA_DISABLED)
@@ -56,7 +57,7 @@ entity makeXonoticCheckBoxEx(float theYesValue, float theNoValue, string theCvar
        me.configureXonoticCheckBox(me, theYesValue, theNoValue, theCvar, theText);
        return me;
 }
-void configureXonoticCheckBoxXonoticCheckBox(entity me, float theYesValue, float theNoValue, string theCvar, string theText)
+void XonoticCheckBox_configureXonoticCheckBox(entity me, float theYesValue, float theNoValue, string theCvar, string theText)
 {
        me.yesValue = theYesValue;
        me.noValue = theNoValue;
@@ -69,7 +70,7 @@ void configureXonoticCheckBoxXonoticCheckBox(entity me, float theYesValue, float
        }
        me.configureCheckBox(me, theText, me.fontSize, me.image);
 }
-void setCheckedXonoticCheckBox(entity me, float val)
+void XonoticCheckBox_setChecked(entity me, float val)
 {
        if(val != me.checked)
        {
@@ -77,25 +78,27 @@ void setCheckedXonoticCheckBox(entity me, float val)
                me.saveCvars(me);
        }
 }
-void loadCvarsXonoticCheckBox(entity me)
+void XonoticCheckBox_loadCvars(entity me)
 {
        float m, d;
 
-       if not(me.cvarName)
+       if (!me.cvarName)
                return;
 
        m = (me.yesValue + me.noValue) * 0.5;
        d = (cvar(me.cvarName) - m) / (me.yesValue - m);
        me.checked = (d > 0);
 }
-void saveCvarsXonoticCheckBox(entity me)
+void XonoticCheckBox_saveCvars(entity me)
 {
-       if not(me.cvarName)
+       if (!me.cvarName)
                return;
 
        if(me.checked)
                cvar_set(me.cvarName, ftos(me.yesValue));
        else
                cvar_set(me.cvarName, ftos(me.noValue));
+
+       CheckSendCvars(me, me.cvarName);
 }
 #endif