add a multi-cvar single-value tgo the text slider
authordiv0 <div0@f962a42d-fe04-0410-a3ab-8c8b0445ebaa>
Tue, 5 Jan 2010 16:13:06 +0000 (16:13 +0000)
committerdiv0 <div0@f962a42d-fe04-0410-a3ab-8c8b0445ebaa>
Tue, 5 Jan 2010 16:13:06 +0000 (16:13 +0000)
git-svn-id: svn://svn.icculus.org/nexuiz/trunk@8480 f962a42d-fe04-0410-a3ab-8c8b0445ebaa

data/qcsrc/menu/nexuiz/dialog_multiplayer_create_advanced.c
data/qcsrc/menu/nexuiz/textslider.c

index 3955084..c454a8c 100644 (file)
@@ -57,10 +57,10 @@ void fillNexuizAdvancedDialog(entity me)
                me.TDempty(me, 0.2);
                me.TD(me, 1, 1.2, e = makeNexuizTextLabel(0, "Teams:"));
                me.TD(me, 1, 1.7, e = makeNexuizTextSlider("g_tdm_teams_override g_domination_teams_override g_keyhunt_teams_override"));
-                       e.addValue(e, "Default", "0 0 0");
-                       e.addValue(e, "2 teams", "2 2 2");
-                       e.addValue(e, "3 teams", "3 3 3");
-                       e.addValue(e, "4 teams", "4 4 4");
+                       e.addValue(e, "Default", "0");
+                       e.addValue(e, "2 teams", "2");
+                       e.addValue(e, "3 teams", "3");
+                       e.addValue(e, "4 teams", "4");
                        e.configureNexuizTextSliderValues(e);
 
        me.gotoRC(me, me.rows - 1, 0);
index 19574e8..d054067 100644 (file)
@@ -77,12 +77,20 @@ void saveCvarsNexuizTextSlider(entity me)
                }
                else
                {
+                       float i;
                        var float m = tokenize_console(strcat(me.cvarName, " ", me.getIdentifier(me)));
-                       if(m != n * 2)
+                       if(m == n + 1)
+                       {
+                               for(i = 0; i < n; ++i)
+                                       cvar_set(argv(i), argv(n));
+                       }
+                       else if(m == n * 2)
+                       {
+                               for(i = 0; i < n; ++i)
+                                       cvar_set(argv(i), argv(i + n));
+                       }
+                       else
                                error("NexuizTextSlider: invalid identifier ", me.getIdentifier(me), " does not match cvar list ", me.cvarName);
-                       float i;
-                       for(i = 0; i < n; ++i)
-                               cvar_set(argv(i), argv(i + n));
                }
        }
 }