MCPcopy Create free account
hub / github.com/assaultcube/AC / favcatcheck

Function favcatcheck

source/src/serverbrowser.cpp:848–874  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

846}
847
848const char *favcatcheck(serverinfo &si, const char *ckeys, char *autokeys = NULL)
849{
850 if(!ckeys) return NULL;
851 static char *nkeys = NULL;
852 const char *sep = " \t\n\r";
853 char *keys = newstring(ckeys), *b, *k = strtok_r(keys, sep, &b);
854 bool res = false;
855 DELETEA(nkeys);
856 nkeys = newstring(strlen(ckeys));
857 nkeys[0] = '\0';
858 while(k)
859 {
860 if(favcatcheckkey(si, k))
861 {
862 res = true;
863 if(autokeys && !(isdigit(*k) && strchr(k, ':'))) concatformatstring(autokeys, *autokeys ? " %s" : "%s", k);
864 }
865 else
866 {
867 if(*nkeys) strcat(nkeys, " ");
868 strcat(nkeys, k);
869 }
870 k = strtok_r(NULL, sep, &b);
871 }
872 delete[] keys;
873 return res ? nkeys : NULL;
874}
875
876void serverbrowseralternativeviews(int shiftdirection)
877{

Callers 1

serverskeyFunction · 0.85

Calls 4

newstringFunction · 0.85
strtok_rFunction · 0.85
favcatcheckkeyFunction · 0.85
concatformatstringFunction · 0.85

Tested by

no test coverage detected