mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
fixed sv_status command
This commit is contained in:
parent
ffa923bbeb
commit
8254bf2336
|
@ -51,6 +51,7 @@ MACRO_CONFIG_STR(sv_map, 128, "dm1")
|
|||
MACRO_CONFIG_INT(sv_map_reload, 0, 0, 1)
|
||||
MACRO_CONFIG_INT(sv_max_clients, 8, 1, 12)
|
||||
MACRO_CONFIG_INT(sv_high_bandwidth, 0, 0, 1)
|
||||
MACRO_CONFIG_INT(sv_status, 0, 0, 1)
|
||||
|
||||
MACRO_CONFIG_INT(debug, 0, 0, 1)
|
||||
MACRO_CONFIG_INT(dbg_stress, 0, 0, 0)
|
||||
|
|
|
@ -798,6 +798,12 @@ void netserver_stats(NETSERVER *s, NETSTATS *stats)
|
|||
}
|
||||
}
|
||||
|
||||
int netserver_client_addr(NETSERVER *s, int client_id, NETADDR4 *addr)
|
||||
{
|
||||
*addr = s->slots[client_id].conn.peeraddr;
|
||||
return 1;
|
||||
}
|
||||
|
||||
NETCLIENT *netclient_open(NETADDR4 bindaddr, int flags)
|
||||
{
|
||||
NETCLIENT *client = (NETCLIENT *)mem_alloc(sizeof(NETCLIENT), 1);
|
||||
|
|
|
@ -47,6 +47,7 @@ int netserver_send(NETSERVER *s, NETPACKET *packet);
|
|||
int netserver_close(NETSERVER *s);
|
||||
int netserver_update(NETSERVER *s);
|
||||
int netserver_drop(NETSERVER *s, int client_id, const char *reason);
|
||||
int netserver_client_addr(NETSERVER *s, int client_id, NETADDR4 *addr);
|
||||
int netserver_max_clients(NETSERVER *s);
|
||||
void netserver_stats(NETSERVER *s, NETSTATS *stats);
|
||||
|
||||
|
|
|
@ -707,6 +707,28 @@ static void server_send_serverinfo(NETADDR4 *addr)
|
|||
netserver_send(net, &packet);
|
||||
}
|
||||
|
||||
static void server_dump_status()
|
||||
{
|
||||
int i;
|
||||
NETADDR4 addr;
|
||||
dbg_msg("server", "-- status --");
|
||||
for(i = 0; i < MAX_CLIENTS; i++)
|
||||
{
|
||||
if(clients[i].state == SRVCLIENT_STATE_INGAME)
|
||||
{
|
||||
netserver_client_addr(net, i, &addr);
|
||||
dbg_msg("server", "id=%d addr=%d.%d.%d.%d:%d name='%s' score=%d",
|
||||
i, addr.ip[0], addr.ip[1], addr.ip[2], addr.ip[3], addr.port,
|
||||
clients[i].name, clients[i].score);
|
||||
}
|
||||
}
|
||||
dbg_msg("server", "-- end status --");
|
||||
|
||||
config.sv_status = 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
static void server_send_fwcheckresponse(NETADDR4 *addr)
|
||||
{
|
||||
|
@ -974,6 +996,12 @@ static int server_run()
|
|||
reporttime += time_freq()*reportinterval;
|
||||
}
|
||||
|
||||
if(config.sv_status)
|
||||
{
|
||||
server_dump_status();
|
||||
config.sv_status = 0;
|
||||
}
|
||||
|
||||
if(config.dbg_hitch)
|
||||
{
|
||||
thread_sleep(config.dbg_hitch);
|
||||
|
|
|
@ -572,8 +572,6 @@ static float evaluate_spawn(spawneval *eval, vec2 pos)
|
|||
else
|
||||
score += 1.0f/d;
|
||||
|
||||
dbg_msg("", "(%f,%f) = %f", pos.x, pos.y, score);
|
||||
|
||||
return score;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue