Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Info code refactoring #604

Merged
merged 19 commits into from
May 4, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ Bugfixed version of rehlds contains an additional cvars:
<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
<li>sv_rehlds_stringcmdrate_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_userinfo_transmitted_fields // Userinfo fields only with these keys will be transmitted to clients via network. If not set then all fields will be transmitted (except prefixed with underscore). Each key must be prefixed by backslash, for example "\name\model\*sid\*hltv\bottomcolor\topcolor". Default: ""
<li>sv_rehlds_userinfo_transmitted_fields // Userinfo fields only with these keys will be transmitted to clients via network. If not set then all fields will be transmitted (except prefixed with underscore). Each key must be prefixed by backslash, for example "\name\model\*sid\*hltv\bottomcolor\topcolor". See [wiki](https://github.com/dreamstalker/rehlds/wiki/Userinfo-keys) to collect sufficient set of keys for your server. Default: ""
<li>sv_rehlds_attachedentities_playeranimationspeed_fix // Fixes bug with gait animation speed increase when player has some attached entities (aiments). Can cause animation lags when cl_updaterate is low. Default: 0
</ul>

Expand Down
4 changes: 2 additions & 2 deletions rehlds/HLTV/common/InfoString.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ bool InfoString::SetString(char *string)
return false;
}

Q_strnlcpy(m_String, string, m_MaxSize);
Q_strlcpy(m_String, string, m_MaxSize);
return true;
}

Expand All @@ -95,7 +95,7 @@ void InfoString::SetMaxSize(unsigned int maxSize)
if (m_String)
{
if (maxSize > Q_strlen(m_String)) {
Q_strnlcpy(newBuffer, m_String, maxSize);
Q_strlcpy(newBuffer, m_String, maxSize);
}

Mem_Free(m_String);
Expand Down
2 changes: 1 addition & 1 deletion rehlds/common/port.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
extern char g_szEXEName[ 4096 ];

#define _snprintf snprintf

#if defined(OSX)
#define SO_ARCH_SUFFIX ".dylib"
#else
Expand Down
50 changes: 45 additions & 5 deletions rehlds/engine/host_cmd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2365,17 +2365,56 @@ void Host_Version_f(void)

void Host_FullInfo_f(void)
{
char key[512];
char value[512];
char *o;
char *s;

if (Cmd_Argc() != 2)
{
Con_Printf("fullinfo <complete info string>\n");
return;
}

#ifdef REHLDS_FIXES
char copy[MAX_INFO_STRING];
Q_strlcpy(copy, Cmd_Argv(1));

char* s = copy;
if (*s != '\\')
return;

bool eos = false;
while (!eos) {
const char* key = ++s;

// key
while (*s != '\\')
{
// key should end with a '\', not a NULL
if (*s == '\0') {
Con_Printf("MISSING VALUE\n");
return;
}

s++;
}

*s = '\0';
const char* value = ++s;

// value
while (*s != '\\') {
if (*s == '\0') {
eos = true;
break;
}

s++;
}

*s = '\0';
#else
char key[512];
char value[512];
char *o;
char *s;

s = (char *)Cmd_Argv(1);
if (*s == '\\')
s++;
Expand All @@ -2400,6 +2439,7 @@ void Host_FullInfo_f(void)
*o = 0;
if (*s)
s++;
#endif

if (cmd_source == src_command)
{
Expand Down
Loading