r5984 - in trunk/data/qcsrc: client common

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Thu Feb 26 01:45:51 EST 2009


Author: div0
Date: 2009-02-26 01:45:50 -0500 (Thu, 26 Feb 2009)
New Revision: 5984

Modified:
   trunk/data/qcsrc/client/sbar.qc
   trunk/data/qcsrc/common/util.qc
   trunk/data/qcsrc/common/util.qh
Log:
fix missing files in last commit


Modified: trunk/data/qcsrc/client/sbar.qc
===================================================================
--- trunk/data/qcsrc/client/sbar.qc	2009-02-26 06:44:53 UTC (rev 5983)
+++ trunk/data/qcsrc/client/sbar.qc	2009-02-26 06:45:50 UTC (rev 5984)
@@ -408,12 +408,6 @@
 	drawfont = sbar_font;
 	digit = stringwidth("0123456789", FALSE) / 10;
 
-	subpattern = strcat(",", GametypeNameFromType(gametype), ",");
-	if(teamplay)
-		subpattern2 = ",teams,";
-	else
-		subpattern2 = ",noteams,";
-
 	for(i = 0; i < argc - 1; ++i)
 	{
 		str = argv(i+1);
@@ -424,22 +418,8 @@
 			pattern = substring(str, 0, slash);
 			str = substring(str, slash + 1, strlen(str) - (slash + 1));
 
-			if(substring(pattern, 0, 1) == "-")
-			{
-				pattern = substring(pattern, 1, strlen(pattern) - 1);
-				if(strstrofs(strcat(",", pattern, ","), subpattern, 0) >= 0)
-					continue;
-				if(strstrofs(strcat(",", pattern, ","), subpattern2, 0) >= 0)
-					continue;
-			}
-			else
-			{
-				if(substring(pattern, 0, 1) == "+")
-					pattern = substring(pattern, 1, strlen(pattern) - 1);
-				if(strstrofs(strcat(",", pattern, ","), subpattern, 0) < 0)
-				if(strstrofs(strcat(",", pattern, ","), subpattern2, 0) < 0)
-					continue;
-			}
+			if not(isGametypeInFilter(gametype, teamplay, pattern))
+				continue;
 		}
 
 		strunzone(sbar_title[sbar_num_fields]);

Modified: trunk/data/qcsrc/common/util.qc
===================================================================
--- trunk/data/qcsrc/common/util.qc	2009-02-26 06:44:53 UTC (rev 5983)
+++ trunk/data/qcsrc/common/util.qc	2009-02-26 06:45:50 UTC (rev 5984)
@@ -1470,3 +1470,31 @@
 	else
 		return strcat(substring(theText, 0, textLengthUpToWidth(theText, maxWidth - tw("..."), tw)), "...");
 }
+
+float isGametypeInFilter(float gt, float tp, string pattern)
+{
+	string subpattern, subpattern2;
+	subpattern = strcat(",", GametypeNameFromType(gt), ",");
+	if(tp)
+		subpattern2 = ",teams,";
+	else
+		subpattern2 = ",noteams,";
+
+	if(substring(pattern, 0, 1) == "-")
+	{
+		pattern = substring(pattern, 1, strlen(pattern) - 1);
+		if(strstrofs(strcat(",", pattern, ","), subpattern, 0) >= 0)
+			return 0;
+		if(strstrofs(strcat(",", pattern, ","), subpattern2, 0) >= 0)
+			return 0;
+	}
+	else
+	{
+		if(substring(pattern, 0, 1) == "+")
+			pattern = substring(pattern, 1, strlen(pattern) - 1);
+		if(strstrofs(strcat(",", pattern, ","), subpattern, 0) < 0)
+		if(strstrofs(strcat(",", pattern, ","), subpattern2, 0) < 0)
+			return 0;
+	}
+	return 1;
+}

Modified: trunk/data/qcsrc/common/util.qh
===================================================================
--- trunk/data/qcsrc/common/util.qh	2009-02-26 06:44:53 UTC (rev 5983)
+++ trunk/data/qcsrc/common/util.qh	2009-02-26 06:45:50 UTC (rev 5984)
@@ -150,3 +150,5 @@
 
 string getWrappedLine_remaining;
 string getWrappedLine(float w, textLengthUpToWidth_widthFunction_t tw);
+
+float isGametypeInFilter(float gt, float tp, string pattern);




More information about the nexuiz-commits mailing list