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

Function newserver

source/src/serverbrowser.cpp:298–317  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

296}
297
298static serverinfo *newserver(const char *name, uint ip = ENET_HOST_ANY, int port = CUBE_DEFAULT_SERVER_PORT, int weight = 0)
299{
300 serverinfo *si = new serverinfo;
301 si->address.host = ip;
302 si->address.port = CUBE_SERVINFO_PORT(port);
303 si->msweight = weight;
304 if(ip!=ENET_HOST_ANY) si->resolved = serverinfo::RESOLVED;
305
306 if(name) copystring(si->name, name);
307 else if(ip==ENET_HOST_ANY || enet_address_get_host_ip(&si->address, si->name, sizeof(si->name)) < 0)
308 {
309 delete si;
310 return NULL;
311 }
312 si->port = port;
313
314 servers.insert(0, si);
315
316 return si;
317}
318
319void addserver(const char *servername, int serverport, int weight)
320{

Callers 2

addserverFunction · 0.85
checkpingsFunction · 0.85

Calls 3

copystringFunction · 0.85
enet_address_get_host_ipFunction · 0.50
insertMethod · 0.45

Tested by

no test coverage detected