2
0
mirror of https://github.com/rehlds/rehlds.git synced 2024-12-28 15:45:46 +03:00

Merge pull request #406 from dreamstalker/fixes20170315

Make mapcycle.txt sending optional, …
This commit is contained in:
theAsmodai 2017-03-15 20:06:18 +03:00 committed by GitHub
commit f943efbbfa
4 changed files with 32 additions and 10 deletions

View File

@ -47,6 +47,7 @@ Bugfixed version of rehlds contains an additional cvars:
<li>sv_rehlds_movecmdrate_avg_punish // Time in minutes for which the player will be banned (0 - Permanent, use a negative number for a kick). Default: 5
<li>sv_rehlds_movecmdrate_max_burst // Max burst level of 'move' cmds for ban. Default: 2500
<li>sv_rehlds_movecmdrate_burst_punish // Time in minutes for which the player will be banned (0 - Permanent, use a negative number for a kick). Default: 5
<li>sv_rehlds_send_mapcycle <1|0> // Send mapcycle.txt in serverinfo message (HLDS behavior, but it is unused on the client). Default: 0
<li>sv_rehlds_stringcmdrate_max_avg // Max average level of 'string' cmds for ban. Default: 80
<li>sv_rehlds_stringcmdrate_avg_punish // Time in minutes for which the player will be banned (0 - Permanent, use a negative number for a kick). Default: 5
<li>sv_rehlds_stringcmdrate_max_burst // Max burst level of 'string' cmds for ban. Default: 400

View File

@ -23,6 +23,11 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "gradle", "gradle", "{FFC337
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dedicated", "..\rehlds\dedicated\msvc\dedicated.vcxproj", "{D49883F3-5C5C-4B9F-B9C7-B31518F228D4}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{D2516ABB-21F2-4393-8CC9-2BD2D3316CD6}"
ProjectSection(SolutionItems) = preProject
..\README.md = ..\README.md
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug Play|Win32 = Debug Play|Win32

View File

@ -530,6 +530,7 @@ extern cvar_t sv_rcon_condebug;
extern cvar_t sv_rehlds_userinfo_transmitted_fields;
extern cvar_t sv_rehlds_attachedentities_playeranimationspeed_fix;
extern cvar_t sv_rehlds_local_gametime;
extern cvar_t sv_rehlds_send_mapcycle;
#endif
extern int sv_playermodel;

View File

@ -312,6 +312,7 @@ cvar_t sv_rcon_condebug = { "sv_rcon_condebug", "1", 0, 1.0f, nullptr };
cvar_t sv_rehlds_userinfo_transmitted_fields = { "sv_rehlds_userinfo_transmitted_fields", "", 0, 0.0f, nullptr };
cvar_t sv_rehlds_attachedentities_playeranimationspeed_fix = {"sv_rehlds_attachedentities_playeranimationspeed_fix", "0", 0, 0.0f, nullptr};
cvar_t sv_rehlds_local_gametime = {"sv_rehlds_local_gametime", "0", 0, 0.0f, nullptr};
cvar_t sv_rehlds_send_mapcycle = { "sv_rehlds_send_mapcycle", "0", 0, 0.0f, nullptr };
#endif
delta_t *SV_LookupDelta(char *name)
@ -1219,23 +1220,34 @@ void SV_SendServerinfo_internal(sizebuf_t *msg, client_t *client)
MSG_WriteString(msg, Cvar_VariableString("hostname"));
MSG_WriteString(msg, g_psv.modelname);
int len = 0;
unsigned char *mapcyclelist = COM_LoadFileForMe(mapcyclefile.string, &len);
#ifdef REHLDS_FIXES
if (mapcyclelist && len)
if (sv_rehlds_send_mapcycle.value)
{
MSG_WriteString(msg, (const char *)mapcyclelist);
int len = 0;
unsigned char *mapcyclelist = COM_LoadFileForMe(mapcyclefile.string, &len);
if (mapcyclelist && len)
{
// Trim to 8190 (see MSG_ReadString, also 1 less than expected - see READ_STRING in HLSDK), otherwise client will be unable to parse message
mapcyclelist[8190] = 0;
MSG_WriteString(msg, (const char *)mapcyclelist);
}
else
{
MSG_WriteString(msg, "mapcycle failure");
}
// FIXED: Mem leak.
if (mapcyclelist)
{
COM_FreeFile(mapcyclelist);
}
}
else
{
MSG_WriteString(msg, "mapcycle failure");
}
// FIXED: Mem leak.
if (mapcyclelist)
{
COM_FreeFile(mapcyclelist);
MSG_WriteString(msg, "");
}
#else // REHLDS_FIXES
int len = 0;
unsigned char *mapcyclelist = COM_LoadFileForMe(mapcyclefile.string, &len);
if (mapcyclelist && len)
{
MSG_WriteString(msg, (const char *)mapcyclelist);
@ -1246,6 +1258,8 @@ void SV_SendServerinfo_internal(sizebuf_t *msg, client_t *client)
MSG_WriteString(msg, "mapcycle failure");
}
#endif // REHLDS_FIXES
// isVAC2Secure
MSG_WriteByte(msg, 0);
MSG_WriteByte(msg, svc_sendextrainfo);
@ -7905,6 +7919,7 @@ void SV_Init(void)
Cvar_RegisterVariable(&sv_rehlds_userinfo_transmitted_fields);
Cvar_RegisterVariable(&sv_rehlds_attachedentities_playeranimationspeed_fix);
Cvar_RegisterVariable(&sv_rehlds_local_gametime);
Cvar_RegisterVariable(&sv_rehlds_send_mapcycle);
#endif
for (int i = 0; i < MAX_MODELS; i++)