improve _cl_name handling
authorRudolf Polzer <divVerent@xonotic.org>
Tue, 18 Jan 2011 09:43:59 +0000 (10:43 +0100)
committerRudolf Polzer <divVerent@xonotic.org>
Tue, 18 Jan 2011 09:43:59 +0000 (10:43 +0100)
qcsrc/menu/xonotic/dialog_firstrun.c
qcsrc/menu/xonotic/dialog_multiplayer_playersetup.c
qcsrc/menu/xonotic/inputbox.c

index 2df99c3ada155e6b486178cc49bd63d3854f1803..55985e0b1676c2ffb07b5a88eb98072aabcd5568 100644 (file)
@@ -52,6 +52,7 @@ void XonoticFirstRunDialog_fill(entity me)
                me.TD(me, 1, 3.0, box = makeXonoticInputBox(1, "_cl_name"));
                        box.forbiddenCharacters = "\r\n\\\"$"; // don't care, isn't getting saved
                        box.maxLength = -127; // negative means encoded length in bytes
+                       box.saveImmediately = 1;
                        label.textEntity = box;
        me.TR(me);
                me.TD(me, 5, 1, e = makeXonoticColorpicker(box));
index d42c9aaa9366d0537b916bccc14c96ee15c754f3..adddf2fd11ec5cae1f43de009da723842d8dfec8 100644 (file)
@@ -47,6 +47,7 @@ void XonoticPlayerSettingsTab_fill(entity me)
                me.TD(me, 1, 3.0, box = makeXonoticInputBox(1, "_cl_name"));
                        box.forbiddenCharacters = "\r\n\\\"$"; // don't care, isn't getting saved
                        box.maxLength = -127; // negative means encoded length in bytes
+                       box.saveImmediately = 1;
                        label.textEntity = box;
        me.TR(me);
                me.TD(me, 5, 1, e = makeXonoticColorpicker(box));
index e457414b4a4ed411b422a7c0404925cab92c7603..2a9c094b8eb07a74ac6752562b3eecfb87cd200a 100644 (file)
@@ -20,6 +20,8 @@ CLASS(XonoticInputBox) EXTENDS(InputBox)
        METHOD(XonoticInputBox, loadCvars, void(entity))
        METHOD(XonoticInputBox, saveCvars, void(entity))
        METHOD(XonoticInputBox, keyDown, float(entity, float, float, float))
+
+       ATTRIB(XonoticInputBox, saveImmediately, float, 0)
 ENDCLASS(XonoticInputBox)
 entity makeXonoticInputBox(float, string);
 #endif
@@ -54,6 +56,8 @@ void XonoticInputBox_setText(entity me, string new)
        {
                SUPER(XonoticInputBox).setText(me, new);
                me.onChange(me, me.onChangeEntity);
+               if(me.saveImmediately)
+                       me.saveCvars(me);
        }
        else
                SUPER(XonoticInputBox).setText(me, new);