X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fmenu%2Fxonotic%2Fradiobutton.c;h=85cc4fc5c559a3c56125fcce05e8aef6f1f7bf6e;hb=b28d93a4701cfb1718e92a86e9e2860dd1a0138a;hp=8c353eae6725aec683419db78b88d6e3ce5274d5;hpb=24c0e211b8a839afe6bb5fc5c603d450a72b9160;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/menu/xonotic/radiobutton.c b/qcsrc/menu/xonotic/radiobutton.c index 8c353eae6..85cc4fc5c 100644 --- a/qcsrc/menu/xonotic/radiobutton.c +++ b/qcsrc/menu/xonotic/radiobutton.c @@ -13,6 +13,7 @@ CLASS(XonoticRadioButton) EXTENDS(RadioButton) ATTRIB(XonoticRadioButton, cvarName, string, string_null) ATTRIB(XonoticRadioButton, cvarValue, string, string_null) ATTRIB(XonoticRadioButton, cvarOffValue, string, string_null) + ATTRIB(XonoticRadioButton, getCvarValueFromCvar, float, 0) METHOD(XonoticRadioButton, loadCvars, void(entity)) METHOD(XonoticRadioButton, saveCvars, void(entity)) @@ -74,8 +75,8 @@ void XonoticRadioButton_loadCvars(entity me) } void XonoticRadioButton_draw(entity me) { - if not(me.cvarValue) - if not(me.cvarName) + if (!me.cvarValue) + if (!me.cvarName) { // this is the "other" option // always select this if none other is @@ -98,7 +99,12 @@ void XonoticRadioButton_saveCvars(entity me) if(me.cvarName) { if(me.checked) - cvar_set(me.cvarName, me.cvarValue); + { + if(me.getCvarValueFromCvar) + cvar_set(me.cvarName, cvar_string(me.cvarValue)); + else + cvar_set(me.cvarName, me.cvarValue); + } else if(me.cvarOffValue) cvar_set(me.cvarName, me.cvarOffValue); }