[nexuiz-commits] r8478 - trunk/data/qcsrc/menu/nexuiz

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Tue Jan 5 11:08:56 EST 2010


Author: div0
Date: 2010-01-05 11:08:48 -0500 (Tue, 05 Jan 2010)
New Revision: 8478

Modified:
   trunk/data/qcsrc/menu/nexuiz/textslider.c
Log:
NexuizSlider: allow multiple cvars to be controlled


Modified: trunk/data/qcsrc/menu/nexuiz/textslider.c
===================================================================
--- trunk/data/qcsrc/menu/nexuiz/textslider.c	2010-01-04 12:45:15 UTC (rev 8477)
+++ trunk/data/qcsrc/menu/nexuiz/textslider.c	2010-01-05 16:08:48 UTC (rev 8478)
@@ -55,7 +55,12 @@
 	if not(me.cvarName)
 		return;
 
-	me.setValueFromIdentifier(me, cvar_string(me.cvarName));
+	var float n = tokenize_console(me.cvarName);
+	var string s = cvar_string(argv(0));
+	float i;
+	for(i = 1; i < n; ++i)
+		s = strcat(s, " ", cvar_string(argv(i)));
+	me.setValueFromIdentifier(me, s);
 }
 void saveCvarsNexuizTextSlider(entity me)
 {
@@ -63,7 +68,23 @@
 		return;
 
 	if(me.value >= 0 && me.value < me.nValues)
-		cvar_set(me.cvarName, me.getIdentifier(me));
+	{
+		var float n = tokenize_console(me.cvarName);
+		if(n == 1)
+		{
+			// this is a special case to allow spaces in the identifiers
+			cvar_set(argv(0), me.getIdentifier(me));
+		}
+		else
+		{
+			var float m = tokenize_console(strcat(me.cvarName, " ", me.getIdentifier(me)));
+			if(m != n * 2)
+				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));
+		}
+	}
 }
 void configureNexuizTextSliderValuesNexuizTextSlider(entity me)
 {



More information about the nexuiz-commits mailing list