]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Add a "teamspawns" and "noteamspawns" feature to gametypefilter. I believe this is...
authorMircea Kitsune <sonichedgehog_hyperblast00@yahoo.com>
Mon, 31 Jan 2011 22:38:27 +0000 (00:38 +0200)
committerMircea Kitsune <sonichedgehog_hyperblast00@yahoo.com>
Mon, 31 Jan 2011 22:38:27 +0000 (00:38 +0200)
qcsrc/client/scoreboard.qc
qcsrc/common/util.qc
qcsrc/common/util.qh
qcsrc/server/sv_main.qc

index 7b90fcda3192e2561843fe7de15ed878d9aec320..c719985d033893428e5f84f4cf103224b4eaf59e 100644 (file)
@@ -356,7 +356,7 @@ void Cmd_HUD_SetFields(float argc)
                        pattern = substring(str, 0, slash);
                        str = substring(str, slash + 1, strlen(str) - (slash + 1));
 
-                       if not(isGametypeInFilter(gametype, teamplay, pattern))
+                       if not(isGametypeInFilter(gametype, teamplay, FALSE, pattern))
                                continue;
                }
 
index 5990f1c9d63cbfab22bd097bca7bfa140801f7ce..fc86c3a842d07704be28ccc1445fcfeccfe782d6 100644 (file)
@@ -1367,18 +1367,22 @@ string textShortenToLength(string theText, float maxWidth, textLengthUpToLength_
                return strcat(substring(theText, 0, textLengthUpToLength(theText, maxWidth - tw("..."), tw)), "...");
 }
 
-float isGametypeInFilter(float gt, float tp, string pattern)
+float isGametypeInFilter(float gt, float tp, float ts, string pattern)
 {
-       string subpattern, subpattern2, subpattern3;
+       string subpattern, subpattern2, subpattern3, subpattern4;
        subpattern = strcat(",", GametypeNameFromType(gt), ",");
        if(tp)
                subpattern2 = ",teams,";
        else
                subpattern2 = ",noteams,";
+       if(ts)
+               subpattern3 = ",teamspawns,";
+       else
+               subpattern3 = ",noteamspawns,";
        if(gt == GAME_RACE || gt == GAME_CTS)
-               subpattern3 = ",race,";
+               subpattern4 = ",race,";
        else
-               subpattern3 = string_null;
+               subpattern4 = string_null;
 
        if(substring(pattern, 0, 1) == "-")
        {
@@ -1387,7 +1391,9 @@ float isGametypeInFilter(float gt, float tp, string pattern)
                        return 0;
                if(strstrofs(strcat(",", pattern, ","), subpattern2, 0) >= 0)
                        return 0;
-               if(subpattern3 && strstrofs(strcat(",", pattern, ","), subpattern3, 0) >= 0)
+               if(strstrofs(strcat(",", pattern, ","), subpattern3, 0) >= 0)
+                       return 0;
+               if(subpattern4 && strstrofs(strcat(",", pattern, ","), subpattern4, 0) >= 0)
                        return 0;
        }
        else
@@ -1396,7 +1402,8 @@ float isGametypeInFilter(float gt, float tp, string pattern)
                        pattern = substring(pattern, 1, strlen(pattern) - 1);
                if(strstrofs(strcat(",", pattern, ","), subpattern, 0) < 0)
                if(strstrofs(strcat(",", pattern, ","), subpattern2, 0) < 0)
-               if((!subpattern3) || strstrofs(strcat(",", pattern, ","), subpattern3, 0) < 0)
+               if(strstrofs(strcat(",", pattern, ","), subpattern3, 0) < 0)
+               if((!subpattern4) || strstrofs(strcat(",", pattern, ","), subpattern4, 0) < 0)
                        return 0;
        }
        return 1;
index 56cba34cc2749aa6949d017584ce337dbc79cdc3..a15855753217765d2396f6ab38f89e127a5060dc 100644 (file)
@@ -142,7 +142,7 @@ string getWrappedLine_remaining;
 string getWrappedLine(float w, vector size, textLengthUpToWidth_widthFunction_t tw);
 string getWrappedLineLen(float w, textLengthUpToLength_lenFunction_t tw);
 
-float isGametypeInFilter(float gt, float tp, string pattern);
+float isGametypeInFilter(float gt, float tp, float ts, string pattern);
 
 typedef void(float i1, float i2, entity pass) swapfunc_t; // is only ever called for i1 < i2
 typedef float(float i1, float i2, entity pass) comparefunc_t; // <0 for <, ==0 for ==, >0 for > (like strcmp)
index aebea7523f66fea9e67d93ee485024bffeb9ff36..a40e8144d6656904d11f7843bcc4d81e7b68431d 100644 (file)
@@ -235,7 +235,7 @@ void StartFrame (void)
 void SV_OnEntityPreSpawnFunction()
 {
        if(self.gametypefilter != "")
-       if not(isGametypeInFilter(game, teams_matter, self.gametypefilter))
+       if not(isGametypeInFilter(game, teams_matter, have_team_spawns, self.gametypefilter))
        {
                remove(self);
                return;