mirror of
https://github.com/libretro/libretro-tyrquake.git
synced 2024-11-27 10:10:58 +00:00
command: move the NQ ping command server side
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
This commit is contained in:
parent
22c61cbe64
commit
ee35b53337
@ -853,4 +853,5 @@ CL_Init(void)
|
||||
Cmd_AddCommand("fly", NULL);
|
||||
Cmd_AddCommand("noclip", NULL);
|
||||
Cmd_AddCommand("notarget", NULL);
|
||||
Cmd_AddCommand("ping", NULL);
|
||||
}
|
||||
|
@ -56,35 +56,6 @@ Host_Quit_f(void)
|
||||
Sys_Quit();
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
Host_Ping_f
|
||||
|
||||
==================
|
||||
*/
|
||||
static void
|
||||
Host_Ping_f(void)
|
||||
{
|
||||
int i, j;
|
||||
float total;
|
||||
client_t *client;
|
||||
|
||||
if (cmd_source == src_command) {
|
||||
Cmd_ForwardToServer();
|
||||
return;
|
||||
}
|
||||
|
||||
SV_ClientPrintf("Client ping times:\n");
|
||||
for (i = 0, client = svs.clients; i < svs.maxclients; i++, client++) {
|
||||
if (!client->active)
|
||||
continue;
|
||||
total = 0;
|
||||
for (j = 0; j < NUM_PING_TIMES; j++)
|
||||
total += client->ping_times[j];
|
||||
total /= NUM_PING_TIMES;
|
||||
SV_ClientPrintf("%4i %s\n", (int)(total * 1000), client->name);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
===============================================================================
|
||||
@ -1335,7 +1306,6 @@ Host_InitCommands(void)
|
||||
Cmd_AddCommand("begin", Host_Begin_f);
|
||||
Cmd_AddCommand("prespawn", Host_PreSpawn_f);
|
||||
Cmd_AddCommand("kick", Host_Kick_f);
|
||||
Cmd_AddCommand("ping", Host_Ping_f);
|
||||
Cmd_AddCommand("load", Host_Loadgame_f);
|
||||
Cmd_AddCommand("save", Host_Savegame_f);
|
||||
Cmd_AddCommand("give", Host_Give_f);
|
||||
|
31
NQ/sv_user.c
31
NQ/sv_user.c
@ -629,6 +629,34 @@ SV_Notarget_f(client_t *client)
|
||||
SV_ClientPrintf("notarget ON\n");
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
SV_Ping_f
|
||||
|
||||
==================
|
||||
*/
|
||||
static void
|
||||
SV_Ping_f(client_t *client)
|
||||
{
|
||||
int i, j;
|
||||
float total;
|
||||
client_t *other;
|
||||
|
||||
SV_ClientPrintf("Client ping times:\n");
|
||||
other = svs.clients;
|
||||
for (i = 0; i < svs.maxclients; i++, other++) {
|
||||
if (!other->active)
|
||||
continue;
|
||||
total = 0;
|
||||
for (j = 0; j < NUM_PING_TIMES; j++)
|
||||
total += other->ping_times[j];
|
||||
total /= NUM_PING_TIMES;
|
||||
SV_ClientPrintf("%4i %s\n", (int)(total * 1000), other->name);
|
||||
}
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------ */
|
||||
|
||||
typedef struct {
|
||||
const char *name;
|
||||
void (*func)(client_t *client);
|
||||
@ -642,6 +670,7 @@ static client_command_t client_commands[] = {
|
||||
{ "fly", SV_Fly_f },
|
||||
{ "noclip", SV_Noclip_f },
|
||||
{ "notarget", SV_Notarget_f },
|
||||
{ "ping", SV_Ping_f },
|
||||
{ NULL, NULL },
|
||||
};
|
||||
|
||||
@ -738,8 +767,6 @@ SV_ReadClientMessage(client_t *client)
|
||||
ret = 1;
|
||||
else if (strncasecmp(message, "kick", 4) == 0)
|
||||
ret = 1;
|
||||
else if (strncasecmp(message, "ping", 4) == 0)
|
||||
ret = 1;
|
||||
else if (strncasecmp(message, "give", 4) == 0)
|
||||
ret = 1;
|
||||
else if (strncasecmp(message, "ban", 3) == 0)
|
||||
|
Loading…
Reference in New Issue
Block a user