server: convert config string to protocol range

This commit is contained in:
Denis Pauk 2024-03-24 01:19:16 +02:00
parent 99f80e12cd
commit 32047010a2
6 changed files with 15 additions and 6 deletions

View file

@ -220,7 +220,8 @@ CL_Record_f(void)
MSG_WriteByte(&buf, svc_configstring); MSG_WriteByte(&buf, svc_configstring);
MSG_WriteShort(&buf, i); /* i in native server range */
MSG_WriteShort(&buf, P_ConvertConfigStringTo(i, PROTOCOL_VERSION));
MSG_WriteString(&buf, cl.configstrings[i]); MSG_WriteString(&buf, cl.configstrings[i]);
} }
} }

View file

@ -677,7 +677,7 @@ CL_ParsePlayerstate(frame_t *oldframe, frame_t *newframe)
if (i == STAT_PICKUP_STRING) if (i == STAT_PICKUP_STRING)
{ {
state->stats[i] = P_ConvertConfigStringFrom(state->stats[i], state->stats[i] = P_ConvertConfigStringFrom(state->stats[i],
cls.serverProtocol); cls.serverProtocol);
} }
} }

View file

@ -611,7 +611,9 @@ SV_ServerRecord_f(void)
if (sv.configstrings[i][0]) if (sv.configstrings[i][0])
{ {
MSG_WriteByte(&buf, svc_configstring); MSG_WriteByte(&buf, svc_configstring);
MSG_WriteShort(&buf, i); /* i in native server range */
MSG_WriteShort(&buf,
P_ConvertConfigStringTo(i, sv_client->protocol));
MSG_WriteString(&buf, sv.configstrings[i]); MSG_WriteString(&buf, sv.configstrings[i]);
if (buf.cursize + 67 >= buf.maxsize) if (buf.cursize + 67 >= buf.maxsize)

View file

@ -192,6 +192,7 @@ PF_setmodel(edict_t *ent, const char *name)
} }
} }
/* Direct set value for config string, index in library range */
static void static void
PF_Configstring(int index, const char *val) PF_Configstring(int index, const char *val)
{ {
@ -206,13 +207,14 @@ PF_Configstring(int index, const char *val)
} }
/* change the string in sv */ /* change the string in sv */
strcpy(sv.configstrings[index], val); strcpy(sv.configstrings[P_ConvertConfigStringFrom(index, sv_client->protocol)], val);
if (sv.state != ss_loading) if (sv.state != ss_loading)
{ {
/* send the update to everyone */ /* send the update to everyone */
SZ_Clear(&sv.multicast); SZ_Clear(&sv.multicast);
MSG_WriteChar(&sv.multicast, svc_configstring); MSG_WriteChar(&sv.multicast, svc_configstring);
/* index in library range */
MSG_WriteShort(&sv.multicast, index); MSG_WriteShort(&sv.multicast, index);
MSG_WriteString(&sv.multicast, val); MSG_WriteString(&sv.multicast, val);

View file

@ -67,7 +67,9 @@ SV_FindIndex(const char *name, int start, int max, qboolean create)
{ {
/* send the update to everyone */ /* send the update to everyone */
MSG_WriteChar(&sv.multicast, svc_configstring); MSG_WriteChar(&sv.multicast, svc_configstring);
MSG_WriteShort(&sv.multicast, start + i); /* i in native server range */
MSG_WriteShort(&sv.multicast,
P_ConvertConfigStringTo(start + i, sv_client->protocol));
MSG_WriteString(&sv.multicast, name); MSG_WriteString(&sv.multicast, name);
SV_Multicast(vec3_origin, MULTICAST_ALL_R); SV_Multicast(vec3_origin, MULTICAST_ALL_R);
} }

View file

@ -142,7 +142,9 @@ SV_Configstrings_f(void)
if (sv.configstrings[start][0]) if (sv.configstrings[start][0])
{ {
MSG_WriteByte(&sv_client->netchan.message, svc_configstring); MSG_WriteByte(&sv_client->netchan.message, svc_configstring);
MSG_WriteShort(&sv_client->netchan.message, start); /* start in native server range */
MSG_WriteShort(&sv_client->netchan.message,
P_ConvertConfigStringTo(start, sv_client->protocol));
MSG_WriteString(&sv_client->netchan.message, MSG_WriteString(&sv_client->netchan.message,
sv.configstrings[start]); sv.configstrings[start]);
} }