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

Function cutcolorstring

source/src/rendertext.cpp:431–445  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

429}
430
431void cutcolorstring(char *text, int maxlen)
432{ // limit string length, ignore color codes
433 if(!curfont) return;
434 int len = 0;
435 maxlen *= curfont->defaultw;
436 while(*text)
437 {
438 if(*text == '\f' && text[1]) text++;
439 else if(*text == '\1' && text[1]) text++, len += FONTH + 1;
440 else if(*text == '\t') len = TABALIGN(len);
441 else len += curfont->chars.inrange(*text - curfont->skip) ? curfont->chars[*text - curfont->skip].w : curfont->defaultw;
442 if(len > maxlen) { *text = '\0'; break; }
443 text++;
444 }
445}
446
447bool filterunrenderables(char *s)
448{

Callers 2

checkpingsFunction · 0.85
loopvFunction · 0.85

Calls 1

inrangeMethod · 0.80

Tested by

no test coverage detected