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

Function findscore

source/src/server.cpp:648–676  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

646}
647
648savedscore *findscore(client &c, bool insert)
649{
650 if(c.type!=ST_TCPIP) return NULL;
651 enet_uint32 mask = ENET_HOST_TO_NET_32(sg->mastermode == MM_MATCH ? 0xFFFF0000 : 0xFFFFFFFF); // in match mode, reconnecting from /16 subnet is allowed
652 if(!insert)
653 {
654 loopv(clients)
655 {
656 client &o = *clients[i];
657 if(o.type!=ST_TCPIP || !o.isauthed) continue;
658 if(o.clientnum!=c.clientnum && o.peer->address.host==c.peer->address.host && !strcmp(o.name, c.name))
659 {
660 static savedscore curscore;
661 curscore.save(o.state, o.team);
662 return &curscore;
663 }
664 }
665 }
666 loopv(savedscores)
667 {
668 savedscore &sc = savedscores[i];
669 if(!strcmp(sc.name, c.name) && (sc.ip & mask) == (c.peer->address.host & mask)) return ≻
670 }
671 if(!insert) return NULL;
672 savedscore &sc = savedscores.add();
673 copystring(sc.name, c.name);
674 sc.ip = c.peer->address.host;
675 return ≻
676}
677
678void sendf(int cn, int chan, const char *format, ...)
679{

Callers 3

disconnect_clientFunction · 0.85
restorescoreFunction · 0.85
processFunction · 0.85

Calls 2

copystringFunction · 0.85
addMethod · 0.45

Tested by

no test coverage detected