]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/util.qc
Merge remote branch 'origin/master' into samual/updatecommands
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / util.qc
index 10f77b6cdfedeb59629f375f4ca5cd9f9a4da2bd..5bb7943fe6d920923e998f3977c45be3c6ccf8d3 100644 (file)
@@ -2108,6 +2108,14 @@ float lowestbit(float f)
        return f;
 }
 
+string strlimitedlen(string input, string truncation, float strip_colors, float limit)
+{
+       if(strlen((strip_colors ? strdecolorize(input) : input)) <= limit)
+               return input;
+       else
+               return strcat(substring(input, 0, (strlen(input) - strlen(truncation))), truncation);
+}
+
 #ifdef CSQC
 entity ReadCSQCEntity()
 {
@@ -2118,3 +2126,4 @@ entity ReadCSQCEntity()
        return findfloat(world, entnum, f);
 }
 #endif
+