| 536 | COMMANDN(getigraph, _getigraph, "s"); |
| 537 | |
| 538 | void encodeigraphs(char *d, const char *s, int len) // find known igraphs in a string and substitute with rendercodes, only used for console messages |
| 539 | { |
| 540 | if(hideigraphs) copystring(d, s, len); |
| 541 | else |
| 542 | { |
| 543 | len--; |
| 544 | string mnem; |
| 545 | loopi(len) |
| 546 | { |
| 547 | if(*s == ':' && (!i || isspace(s[-1])) && i < len - 1) |
| 548 | { |
| 549 | int l = strcspn(s + 1, " \t\n."), u; |
| 550 | if(l && l < MAXSTRLEN) |
| 551 | { |
| 552 | copystring(mnem, s + 1, l + 1); |
| 553 | if((u = getigraph(mnem))) |
| 554 | { // found one: encode |
| 555 | *d++ = '\1'; |
| 556 | *d++ = u; |
| 557 | s += l + 1; |
| 558 | i++; |
| 559 | continue; |
| 560 | } |
| 561 | } |
| 562 | } |
| 563 | *d++ = *s++; |
| 564 | } |
| 565 | *d = '\0'; |
| 566 | } |
| 567 | } |
| 568 | |
| 569 | void enumigraphs(vector<const char *> &igs, const char *s, int len) |
| 570 | { |
no test coverage detected