| 626 | } |
| 627 | |
| 628 | int 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 |
no test coverage detected