mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2025-02-02 05:52:15 +00:00
server: use game api version for protocol detect
This commit is contained in:
parent
1364e4703f
commit
f7ec7d268e
4 changed files with 20 additions and 16 deletions
|
@ -238,6 +238,7 @@ void SV_StartSound(vec3_t origin, edict_t *entity, int channel,
|
||||||
void SV_ClientPrintf(client_t *cl, int level, const char *fmt, ...);
|
void SV_ClientPrintf(client_t *cl, int level, const char *fmt, ...);
|
||||||
void SV_BroadcastPrintf(int level, const char *fmt, ...);
|
void SV_BroadcastPrintf(int level, const char *fmt, ...);
|
||||||
void SV_BroadcastCommand(const char *fmt, ...);
|
void SV_BroadcastCommand(const char *fmt, ...);
|
||||||
|
int SV_GetRecomendedProtocol(void);
|
||||||
|
|
||||||
void SV_Nextserver(void);
|
void SV_Nextserver(void);
|
||||||
void SV_ExecuteClientMessage(client_t *cl);
|
void SV_ExecuteClientMessage(client_t *cl);
|
||||||
|
|
|
@ -186,7 +186,7 @@ SV_GameMap_f(void)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Com_DPrintf("SV_GameMap(%s)\n", Cmd_Argv(1));
|
Com_DPrintf("%s(%s)\n", __func__, Cmd_Argv(1));
|
||||||
|
|
||||||
FS_CreatePath(va("%s/save/current/", FS_Gamedir()));
|
FS_CreatePath(va("%s/save/current/", FS_Gamedir()));
|
||||||
|
|
||||||
|
@ -595,7 +595,7 @@ SV_ServerRecord_f(void)
|
||||||
/* serverdata needs to go over for all types of servers
|
/* serverdata needs to go over for all types of servers
|
||||||
to make sure the protocol is right, and to set the gamedir */
|
to make sure the protocol is right, and to set the gamedir */
|
||||||
MSG_WriteByte(&buf, svc_serverdata);
|
MSG_WriteByte(&buf, svc_serverdata);
|
||||||
MSG_WriteLong(&buf, PROTOCOL_VERSION);
|
MSG_WriteLong(&buf, SV_GetRecomendedProtocol());
|
||||||
MSG_WriteLong(&buf, svs.spawncount);
|
MSG_WriteLong(&buf, svs.spawncount);
|
||||||
|
|
||||||
/* 2 means server demo */
|
/* 2 means server demo */
|
||||||
|
|
|
@ -201,10 +201,7 @@ PF_Configstring(int index, const char *val)
|
||||||
val = "";
|
val = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sv_client)
|
index = P_ConvertConfigStringFrom(index, SV_GetRecomendedProtocol());
|
||||||
{
|
|
||||||
index = P_ConvertConfigStringFrom(index, sv_client->protocol);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((index < 0) || (index >= MAX_CONFIGSTRINGS))
|
if ((index < 0) || (index >= MAX_CONFIGSTRINGS))
|
||||||
{
|
{
|
||||||
|
|
|
@ -44,6 +44,21 @@ SV_BeginDemoserver(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
SV_GetRecomendedProtocol(void)
|
||||||
|
{
|
||||||
|
if (ge->apiversion == GAME_API_R97_VERSION)
|
||||||
|
{
|
||||||
|
/* backward compatibility */
|
||||||
|
return PROTOCOL_R97_VERSION;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return PROTOCOL_VERSION;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Sends the first message from the server to a connected client.
|
* Sends the first message from the server to a connected client.
|
||||||
* This will be sent on the initial connection and upon each server load.
|
* This will be sent on the initial connection and upon each server load.
|
||||||
|
@ -75,16 +90,7 @@ SV_New_f(void)
|
||||||
gamedir = (char *)Cvar_VariableString("gamedir");
|
gamedir = (char *)Cvar_VariableString("gamedir");
|
||||||
|
|
||||||
/* send the serverdata */
|
/* send the serverdata */
|
||||||
if (ge->apiversion == GAME_API_R97_VERSION)
|
sv_client->protocol = SV_GetRecomendedProtocol();
|
||||||
{
|
|
||||||
/* backward compatibility */
|
|
||||||
sv_client->protocol = PROTOCOL_R97_VERSION;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
sv_client->protocol = PROTOCOL_VERSION;
|
|
||||||
}
|
|
||||||
|
|
||||||
MSG_WriteByte(&sv_client->netchan.message, svc_serverdata);
|
MSG_WriteByte(&sv_client->netchan.message, svc_serverdata);
|
||||||
MSG_WriteLong(&sv_client->netchan.message, sv_client->protocol);
|
MSG_WriteLong(&sv_client->netchan.message, sv_client->protocol);
|
||||||
MSG_WriteLong(&sv_client->netchan.message, svs.spawncount);
|
MSG_WriteLong(&sv_client->netchan.message, svs.spawncount);
|
||||||
|
|
Loading…
Reference in a new issue