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

Function gmode_parse

source/src/protocol.cpp:524–534  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

522}
523
524int gmode_parse(const char *list) // convert a list of mode acronyms to a bitmask
525{
526 char *buf = newstring(list), *b;
527 int res = 0;
528 for(char *p = strtok_r(buf, "|", &b); p; p = strtok_r(NULL, "|", &b))
529 {
530 loopi(GMODE_NUM) if(!strcasecmp(p, modeacronymnames[i + 1])) res |= 1 << i;
531 }
532 delete buf;
533 return res;
534}
535
536char *gmode_enum(int gm, char *buf) // convert mode bitmask to string with sorted list of mode acronyms
537{

Callers 2

loadMethod · 0.85
modeinfoFunction · 0.85

Calls 3

newstringFunction · 0.85
strtok_rFunction · 0.85
loopiFunction · 0.70

Tested by

no test coverage detected