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

Function nearestenemy

source/src/clientgame.cpp:703–715  ·  view source on GitHub ↗

returns -1 for a free place, else dist to the nearest enemy

Source from the content-addressed store, hash-verified

701
702// returns -1 for a free place, else dist to the nearest enemy
703float nearestenemy(vec place, int team)
704{
705 float nearestenemydist = -1;
706 loopv(players)
707 {
708 playerent *other = players[i];
709 if(!other || isteam(team, other->team)) continue;
710 float dist = place.dist(other->o);
711 if(dist < nearestenemydist || nearestenemydist == -1) nearestenemydist = dist;
712 }
713 if(nearestenemydist >= SECURESPAWNDIST || nearestenemydist < 0) return -1;
714 else return nearestenemydist;
715}
716
717void gotoplayerstart(playerent *d, entity *e)
718{

Callers 1

loopiFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected