diff options
author | /dev/humancontroller <devhc@example.com> | 2017-03-11 22:00:02 +0100 |
---|---|---|
committer | /dev/humancontroller <devhc@example.com> | 2017-03-11 22:00:02 +0100 |
commit | 236c5db600ca7710cd63505e1c4fd758686294d4 (patch) | |
tree | b402a6cc1581320e2f4427d456afd1676a2fac62 | |
parent | 1ad6646606b958bafbebb18a7c610a009d86dba2 (diff) |
tell funny version information in status responses (and configstrings)
-rw-r--r-- | src/server/sv_init.c | 33 | ||||
-rw-r--r-- | src/server/sv_main.c | 2 |
2 files changed, 22 insertions, 13 deletions
diff --git a/src/server/sv_init.c b/src/server/sv_init.c index c14b4f59..dbb12681 100644 --- a/src/server/sv_init.c +++ b/src/server/sv_init.c @@ -134,16 +134,21 @@ void SV_SetConfigstring (int index, const char *val) { } if ( index <= CS_SYSTEMINFO ) { - for ( i = 1; i < 3; ++i ) { + for ( i = 0; i < 3; ++i ) { char info[BIG_INFO_STRING]; if ( index == CS_SERVERINFO ) { Q_strncpyz( info, val, MAX_INFO_STRING ); - Info_SetValueForKey( info, "protocol", ( i == 1 ? "70" : "69" ) ); + if ( i != 0 ) { + Info_SetValueForKey( info, "protocol", ( i == 1 ? "70" : "69" ) ); + } + Info_SetValueForKey( info, "version", "zittrig gentoo 2038-01-19T03:14:09Z" ); } else { Q_strncpyz( info, val, BIG_INFO_STRING ); - Info_SetValueForKey_Big( info, "sv_voipProtocol", NULL ); - Info_SetValueForKey_Big( info, "voip", va("%i", sv_voip->integer) ); + if ( i != 0 ) { + Info_SetValueForKey_Big( info, "sv_voipProtocol", NULL ); + Info_SetValueForKey_Big( info, "voip", va("%i", sv_voip->integer) ); + } if ( i == 2 ) { Info_SetValueForKey_Big( info, "sv_paks", Cvar_VariableString( "sv_alternatePaks" ) ); Info_SetValueForKey_Big( info, "sv_pakNames", Cvar_VariableString( "sv_alternatePakNames" ) ); @@ -157,18 +162,20 @@ void SV_SetConfigstring (int index, const char *val) { } } - if ( strcmp( info, alternateInfos[index][i - 1] ) ) { - modified[i] = qtrue; - strcpy( alternateInfos[index][i - 1], info ); + if ( i == 0 ) { + if ( strcmp( info, sv.configstrings[index].s ) ) { + modified[0] = qtrue; + Z_Free( sv.configstrings[index].s ); + sv.configstrings[index].s = CopyString( info ); + } + } else { + if ( strcmp( info, alternateInfos[index][i - 1] ) ) { + modified[i] = qtrue; + strcpy( alternateInfos[index][i - 1], info ); + } } } - if ( strcmp( val, sv.configstrings[index].s ) ) { - modified[0] = qtrue; - Z_Free( sv.configstrings[index].s ); - sv.configstrings[index].s = CopyString( val ); - } - if ( !modified[0] && !modified[1] && !modified[2] ) { return; } diff --git a/src/server/sv_main.c b/src/server/sv_main.c index 19ec5cea..e5e7e5f1 100644 --- a/src/server/sv_main.c +++ b/src/server/sv_main.c @@ -562,6 +562,8 @@ static void SVC_Status( netadr_t from ) { if ( from.alternateProtocol != 0 ) Info_SetValueForKey( infostring, "protocol", from.alternateProtocol == 2 ? "69" : "70" ); + Info_SetValueForKey( infostring, "version", "zittrig gentoo 2038-01-19T03:14:09Z" ); + status[0] = 0; statusLength = 0; |