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

Function encodeigraphs

source/src/rendertext.cpp:538–567  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

536COMMANDN(getigraph, _getigraph, "s");
537
538void 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
569void enumigraphs(vector<const char *> &igs, const char *s, int len)
570{

Callers 1

consolebufferClass · 0.85

Calls 1

copystringFunction · 0.85

Tested by

no test coverage detected