client: Add network/demo protocol version print

This commit is contained in:
Denis Pauk 2023-10-30 00:41:08 +02:00
parent 0792a535fa
commit 585af3a0bd
3 changed files with 40 additions and 4 deletions

View file

@ -843,8 +843,35 @@ CL_ParseServerData(void)
cls.serverProtocol = i; cls.serverProtocol = i;
/* another demo hack */ /* another demo hack */
if (Com_ServerState() && (PROTOCOL_VERSION == 34)) if (Com_ServerState() && (
(i == PROTOCOL_RELEASE_VERSION) ||
(i == PROTOCOL_DEMO_VERSION) ||
(i == PROTOCOL_VERSION) ||
(i == PROTOCOL_RR22_VERSION) ||
(i == PROTOCOL_RR23_VERSION)))
{ {
Com_Printf("Network protocol: ");
switch (i)
{
case PROTOCOL_RELEASE_VERSION:
Com_Printf("Quake 2 Demo\n");
break;
case PROTOCOL_DEMO_VERSION:
Com_Printf("Quake 2 Release Demo\n");
break;
case PROTOCOL_VERSION:
Com_Printf("Quake 2\n");
break;
case PROTOCOL_RR22_VERSION:
Com_Printf("ReRelease Quake 2 Demo\n");
break;
case PROTOCOL_RR23_VERSION:
Com_Printf("ReRelease Quake 2\n");
break;
default:
Com_Printf("Unknown protocol version\n");
break;
};
} }
else if (i != PROTOCOL_VERSION) else if (i != PROTOCOL_VERSION)
{ {
@ -1071,7 +1098,7 @@ CL_ParseConfigString(void)
if ((i < 0) || (i >= MAX_CONFIGSTRINGS)) if ((i < 0) || (i >= MAX_CONFIGSTRINGS))
{ {
Com_Error(ERR_DROP, "configstring > MAX_CONFIGSTRINGS"); Com_Error(ERR_DROP, "%s: configstring > MAX_CONFIGSTRINGS", __func__);
} }
s = MSG_ReadString(&net_message); s = MSG_ReadString(&net_message);
@ -1081,7 +1108,7 @@ CL_ParseConfigString(void)
length = strlen(s); length = strlen(s);
if (length > sizeof(cl.configstrings) - sizeof(cl.configstrings[0])*i - 1) if (length > sizeof(cl.configstrings) - sizeof(cl.configstrings[0])*i - 1)
{ {
Com_Error(ERR_DROP, "CL_ParseConfigString: oversize configstring"); Com_Error(ERR_DROP, "%s: oversize configstring", __func__);
} }
strcpy(cl.configstrings[i], s); strcpy(cl.configstrings[i], s);

View file

@ -175,7 +175,16 @@ void Info_Print(char *s);
/* PROTOCOL */ /* PROTOCOL */
/* Quake 2 Release Demos */
#define PROTOCOL_RELEASE_VERSION 26
/* Quake 2 Demo */
#define PROTOCOL_DEMO_VERSION 31
/* Quake 2 Network Release */
#define PROTOCOL_VERSION 34 #define PROTOCOL_VERSION 34
/* ReRelease demo files */
#define PROTOCOL_RR22_VERSION 2022
/* ReRelease network protocol */
#define PROTOCOL_RR23_VERSION 2023
/* ========================================= */ /* ========================================= */

View file

@ -559,7 +559,7 @@ SV_SendClientMessages(void)
if (msglen > MAX_MSGLEN) if (msglen > MAX_MSGLEN)
{ {
Com_Error(ERR_DROP, Com_Error(ERR_DROP,
"SV_SendClientMessages: msglen > MAX_MSGLEN"); "%s: msglen > MAX_MSGLEN", __func__);
} }
r = FS_FRead(msgbuf, msglen, 1, sv.demofile); r = FS_FRead(msgbuf, msglen, 1, sv.demofile);