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

Function clampentityattributes

source/src/entities.cpp:666–683  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

664}
665
666void clampentityattributes(persistent_entity &e)
667{
668 if(e.type < MAXENTTYPES)
669 {
670 int c;
671 #define CLAMPATTR(x) \
672 c = entwraparound[e.type][x - 1]; \
673 if(c > 0) e.attr##x = (e.attr##x % c + c) % c; /* fold value into range 0..c */ \
674 else if(c < 0) e.attr##x = e.attr##x % (-c) /* fold value into range -c..c */
675 CLAMPATTR(1);
676 CLAMPATTR(2);
677 CLAMPATTR(3);
678 CLAMPATTR(4);
679 CLAMPATTR(5);
680 CLAMPATTR(6);
681 CLAMPATTR(7);
682 }
683}
684
685const char *formatentityattributes(const persistent_entity &e, bool withcomma)
686{

Callers 5

entpropertyFunction · 0.85
newentityFunction · 0.85
editentityFunction · 0.85
save_worldFunction · 0.85
loopvFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected