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

Function distributeteam

source/src/server.cpp:1593–1611  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1591vector<twoint> sdistrib;
1592
1593void distributeteam(int team)
1594{
1595 int numsp = 0;
1596 if(sg->curmap) numsp = team == 100 ? sg->curmap->entstats.spawns[2] : sg->curmap->entstats.spawns[team & 1];
1597 if(!numsp) numsp = 30; // no spawns: try to distribute anyway
1598 twoint ti;
1599 sdistrib.shrink(0);
1600 loopi(numsp)
1601 {
1602 ti.val = i;
1603 ti.key = rnd(0x1000000);
1604 sdistrib.add(ti);
1605 }
1606 sdistrib.sort(cmpintasc); // random spawn order
1607 loopv(clients)
1608 {
1609 clients[i]->spawnindex = sdistrib[i % sdistrib.length()].val;
1610 }
1611}
1612
1613void distributespawns()
1614{

Callers 1

distributespawnsFunction · 0.85

Calls 2

shrinkMethod · 0.80
sortMethod · 0.80

Tested by

no test coverage detected