mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2025-01-13 13:21:31 +00:00
Merge remote-tracking branch 'origin/master' into next
This commit is contained in:
commit
5e9c197f8a
1 changed files with 68 additions and 2 deletions
|
@ -1392,6 +1392,70 @@ static boolean CL_SendJoin(void)
|
|||
return HSendPacket(servernode, false, 0, sizeof (clientconfig_pak));
|
||||
}
|
||||
|
||||
static void
|
||||
CopyCaretColors (char *p, const char *s, int n)
|
||||
{
|
||||
char *t;
|
||||
int m;
|
||||
int c;
|
||||
if (!n)
|
||||
return;
|
||||
while (( t = strchr(s, '^') ))
|
||||
{
|
||||
m = ( t - s );
|
||||
|
||||
if (m >= n)
|
||||
{
|
||||
memcpy(p, s, n);
|
||||
return;
|
||||
}
|
||||
else
|
||||
memcpy(p, s, m);
|
||||
|
||||
p += m;
|
||||
n -= m;
|
||||
s += m;
|
||||
|
||||
if (!n)
|
||||
return;
|
||||
|
||||
if (s[1])
|
||||
{
|
||||
c = toupper(s[1]);
|
||||
if (isdigit(c))
|
||||
c = 0x80 + ( c - '0' );
|
||||
else if (c >= 'A' && c <= 'F')
|
||||
c = 0x80 + ( c - 'A' );
|
||||
else
|
||||
c = 0;
|
||||
|
||||
if (c)
|
||||
{
|
||||
*p++ = c;
|
||||
n--;
|
||||
|
||||
if (!n)
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (n < 2)
|
||||
break;
|
||||
|
||||
memcpy(p, s, 2);
|
||||
|
||||
p += 2;
|
||||
n -= 2;
|
||||
}
|
||||
|
||||
s += 2;
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
strncpy(p, s, n);
|
||||
}
|
||||
|
||||
static void SV_SendServerInfo(INT32 node, tic_t servertime)
|
||||
{
|
||||
UINT8 *p;
|
||||
|
@ -1420,8 +1484,7 @@ static void SV_SendServerInfo(INT32 node, tic_t servertime)
|
|||
(dedicated ? SV_DEDICATED : 0)
|
||||
);
|
||||
|
||||
|
||||
strncpy(netbuffer->u.serverinfo.servername, cv_servername.string,
|
||||
CopyCaretColors(netbuffer->u.serverinfo.servername, cv_servername.string,
|
||||
MAXSERVERNAME);
|
||||
strncpy(netbuffer->u.serverinfo.mapname, G_BuildMapName(gamemap), 7);
|
||||
|
||||
|
@ -4156,6 +4219,7 @@ static void HandleTimeout(SINT8 node)
|
|||
*/
|
||||
static void HandleServerInfo(SINT8 node)
|
||||
{
|
||||
char servername[MAXSERVERNAME];
|
||||
// compute ping in ms
|
||||
const tic_t ticnow = I_GetTime();
|
||||
const tic_t ticthen = (tic_t)LONG(netbuffer->u.serverinfo.time);
|
||||
|
@ -4164,6 +4228,8 @@ static void HandleServerInfo(SINT8 node)
|
|||
netbuffer->u.serverinfo.servername[MAXSERVERNAME-1] = 0;
|
||||
netbuffer->u.serverinfo.application
|
||||
[sizeof netbuffer->u.serverinfo.application - 1] = '\0';
|
||||
memcpy(servername, netbuffer->u.serverinfo.servername, MAXSERVERNAME);
|
||||
CopyCaretColors(netbuffer->u.serverinfo.servername, servername, MAXSERVERNAME);
|
||||
netbuffer->u.serverinfo.gametype = (UINT8)((netbuffer->u.serverinfo.gametype == VANILLA_GT_MATCH) ? GT_MATCH : GT_RACE);
|
||||
|
||||
SL_InsertServer(&netbuffer->u.serverinfo, node);
|
||||
|
|
Loading…
Reference in a new issue