#include "sv_demo.h"
#include "image.h"
+#include "utf8lib.h"
+
// for secure rcon authentication
#include "hmac.h"
#include "mdfour.h"
for (j = 0;j < NETGRAPH_PACKETS;j++)
if (client->netconnection->incoming_netgraph[j].unreliablebytes == NETGRAPH_LOSTPACKET)
packetloss++;
- packetloss = packetloss * 100 / NETGRAPH_PACKETS;
+ packetloss = (packetloss * 100 + NETGRAPH_PACKETS - 1) / NETGRAPH_PACKETS;
ping = bound(0, (int)floor(client->ping*1000+0.5), 9999);
}
}
}
+ // unlink all entities
+ World_UnlinkAll(&sv.world);
+
// load the edicts out of the savegame file
end = t;
for (;;)
host_client->name[1] = '0' + STRING_COLOR_DEFAULT;
}
- COM_StringLengthNoColors(host_client->name, 0, &valid_colors);
+ u8_COM_StringLengthNoColors(host_client->name, 0, &valid_colors);
if(!valid_colors) // NOTE: this also proves the string is not empty, as "" is a valid colored string
{
size_t l;
MSG_WriteByte (&net_message, CCREQ_RCON);
SZ_Write(&net_message, (void*)rcon_password.string, n);
MSG_WriteString (&net_message, Cmd_Args());
- *((int *)net_message.data) = BigLong(NETFLAG_CTL | (net_message.cursize & NETFLAG_LENGTH_MASK));
+ StoreBigLong(net_message.data, NETFLAG_CTL | (net_message.cursize & NETFLAG_LENGTH_MASK));
NetConn_Write(mysocket, net_message.data, net_message.cursize, &to);
SZ_Clear (&net_message);
}
*/
void Host_Pings_f (void)
{
- int i, j, ping, packetloss;
+ int i, j, ping, packetloss, movementloss;
char temp[128];
if (!host_client->netconnection)
for (i = 0;i < svs.maxclients;i++)
{
packetloss = 0;
+ movementloss = 0;
if (svs.clients[i].netconnection)
+ {
for (j = 0;j < NETGRAPH_PACKETS;j++)
if (svs.clients[i].netconnection->incoming_netgraph[j].unreliablebytes == NETGRAPH_LOSTPACKET)
packetloss++;
- packetloss = packetloss * 100 / NETGRAPH_PACKETS;
+ for (j = 0;j < NETGRAPH_PACKETS;j++)
+ if (svs.clients[i].movement_count[j] < 0)
+ movementloss++;
+ }
+ packetloss = (packetloss * 100 + NETGRAPH_PACKETS - 1) / NETGRAPH_PACKETS;
+ movementloss = (movementloss * 100 + NETGRAPH_PACKETS - 1) / NETGRAPH_PACKETS;
ping = (int)floor(svs.clients[i].ping*1000+0.5);
ping = bound(0, ping, 9999);
if (sv.protocol == PROTOCOL_QUAKEWORLD)
else
{
// write the string into the packet as multiple unterminated strings to avoid needing a local buffer
- dpsnprintf(temp, sizeof(temp), " %d %d", ping, packetloss);
+ if(movementloss)
+ dpsnprintf(temp, sizeof(temp), " %d %d,%d", ping, packetloss, movementloss);
+ else
+ dpsnprintf(temp, sizeof(temp), " %d %d", ping, packetloss);
MSG_WriteUnterminatedString(&host_client->netconnection->message, temp);
}
}
void Host_PingPLReport_f(void)
{
+ char *errbyte;
int i;
int l = Cmd_Argc();
if (l > cl.maxclients)
for (i = 0;i < l;i++)
{
cl.scores[i].qw_ping = atoi(Cmd_Argv(1+i*2));
- cl.scores[i].qw_packetloss = atoi(Cmd_Argv(1+i*2+1));
+ cl.scores[i].qw_packetloss = strtol(Cmd_Argv(1+i*2+1), &errbyte, 0);
+ if(errbyte && *errbyte == ',')
+ cl.scores[i].qw_movementloss = atoi(errbyte + 1);
+ else
+ cl.scores[i].qw_movementloss = 0;
}
}