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

Function getlistindex

source/src/tools.cpp:628–643  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

626}
627
628int getlistindex(const char *key, const char *list[], bool acceptnumeric, int deflt)
629{
630 int max = 0;
631 while(list[max] && list[max][0]) if(!strcasecmp(key, list[max])) return max; else max++;
632 if(acceptnumeric && isdigit(key[0]))
633 {
634 int i = (int)strtol(key, NULL, 0);
635 if(i >= 0 && i < max) return i;
636 }
637#if !defined(STANDALONE) && defined(_DEBUG)
638 char *opts = conc(list, -1, true);
639 if(!isdedicated && *key) clientlogf("warning: unknown token \"%s\" (not in list [%s])", key, opts);
640 delstring(opts);
641#endif
642 return deflt;
643}
644
645//////////////// geometry utils ////////////////
646

Callers 15

findtypeFunction · 0.85
enumentitiesFunction · 0.85
nextvalueMethod · 0.85
mdlattributeFunction · 0.85
getmapmodelattributesFunction · 0.85
initMethod · 0.85
parseMethod · 0.85
addlineMethod · 0.85
md2emitFunction · 0.85
loadcrosshairFunction · 0.85
getvarrangeFunction · 0.85

Calls 3

concFunction · 0.85
clientlogfFunction · 0.85
delstringFunction · 0.85

Tested by

no test coverage detected