diff options
-rw-r--r-- | Makefile | 3 | ||||
-rw-r--r-- | assets/ui/ptrc.menu | 109 | ||||
-rw-r--r-- | src/cgame/cg_ptr.c | 84 | ||||
-rw-r--r-- | src/cgame/cg_servercmds.c | 34 | ||||
-rw-r--r-- | src/game/g_active.c | 2 | ||||
-rw-r--r-- | src/game/g_admin.c | 138 | ||||
-rw-r--r-- | src/game/g_admin.h | 15 | ||||
-rw-r--r-- | src/game/g_client.c | 47 | ||||
-rw-r--r-- | src/game/g_cmds.c | 110 | ||||
-rw-r--r-- | src/game/g_local.h | 49 | ||||
-rw-r--r-- | src/game/g_main.c | 4 | ||||
-rw-r--r-- | src/game/g_namelog.c | 111 | ||||
-rw-r--r-- | src/game/g_ptr.c | 174 | ||||
-rw-r--r-- | src/game/g_team.c | 5 | ||||
-rw-r--r-- | src/ui/ui_main.c | 22 |
15 files changed, 206 insertions, 701 deletions
@@ -1605,7 +1605,6 @@ CGOBJ_ = \ $(B)/base/cgame/cg_attachment.o \ $(B)/base/cgame/cg_trails.o \ $(B)/base/cgame/cg_particles.o \ - $(B)/base/cgame/cg_ptr.o \ $(B)/base/cgame/cg_tutorial.o \ $(B)/base/ui/ui_shared.o \ \ @@ -1654,9 +1653,9 @@ GOBJ_ = \ $(B)/base/game/g_trigger.o \ $(B)/base/game/g_utils.o \ $(B)/base/game/g_maprotation.o \ - $(B)/base/game/g_ptr.o \ $(B)/base/game/g_weapon.o \ $(B)/base/game/g_admin.o \ + $(B)/base/game/g_namelog.o \ \ $(B)/base/qcommon/q_math.o \ $(B)/base/qcommon/q_shared.o diff --git a/assets/ui/ptrc.menu b/assets/ui/ptrc.menu deleted file mode 100644 index f4785f33..00000000 --- a/assets/ui/ptrc.menu +++ /dev/null @@ -1,109 +0,0 @@ -#include "ui/menudef.h" - -{ - // PTRC POPUP MENU // - -#define W 280 -#define H 140 -#define BORDER 10 - -#define BUTT_H 25 -#define BUTT_W 45 - -#define INFO_W (W-(2*BORDER)) -#define INFO_H (H-((3*BORDER)+BUTT_H)) -#define INFO_X BORDER -#define INFO_Y BORDER - - menuDef - { - name "ptrc_popmenu" - visible MENU_FALSE - fullscreen MENU_FALSE - rect (320-(W/2)) (240-(H/2)) W H - focusColor 1 .75 0 1 - style WINDOW_STYLE_FILLED - border WINDOW_BORDER_FULL - popup - onESC - { - play "sound/misc/menu1.wav"; - close ptrc_popmenu - } - - - itemDef - { - name window - rect 0 0 W H - style WINDOW_STYLE_FILLED - backcolor 0 0 0 1 - visible MENU_TRUE - decoration - - border WINDOW_BORDER_FULL - borderSize 1.0 - borderColor 0.5 0.5 0.5 1 - } - - - // PTRC // - - itemDef - { - name confirm - type ITEM_TYPE_TEXT - text "It seems that you disconnected during this game. Would you like to be restored to your previous state?" - style WINDOW_STYLE_EMPTY - textscale .4 - textstyle WINDOW_STYLE_SHADER - rect INFO_X INFO_Y INFO_W INFO_H - textalign ALIGN_CENTER - textvalign VALIGN_CENTER - decoration - wrapped - forecolor 1 1 1 1 - visible MENU_TRUE - } - - itemDef - { - name yes - text "YES" - type ITEM_TYPE_BUTTON - textscale .4 - rect (W-((2*BORDER)+(2*BUTT_W))) (H-(BORDER+BUTT_H)) BUTT_W BUTT_H - textalign ALIGN_CENTER - textvalign VALIGN_CENTER - forecolor 1 1 1 1 - visible MENU_TRUE - action - { - play "sound/misc/menu4.wav"; - uiScript PTRCRestore; - close ptrc_popmenu - } - } - - - itemDef - { - name no - text "NO" - type ITEM_TYPE_BUTTON - textscale .4 - rect (W-(BORDER+BUTT_W)) (H-(BORDER+BUTT_H)) BUTT_W BUTT_H - textalign ALIGN_CENTER - textvalign VALIGN_CENTER - forecolor 1 1 1 1 - visible MENU_TRUE - action - { - play "sound/misc/menu1.wav"; - close ptrc_popmenu - } - } - } -} - - diff --git a/src/cgame/cg_ptr.c b/src/cgame/cg_ptr.c deleted file mode 100644 index f9f7405a..00000000 --- a/src/cgame/cg_ptr.c +++ /dev/null @@ -1,84 +0,0 @@ -/* -=========================================================================== -Copyright (C) 2000-2009 Darklegion Development - -This file is part of Tremulous. - -Tremulous is free software; you can redistribute it -and/or modify it under the terms of the GNU General Public License as -published by the Free Software Foundation; either version 2 of the License, -or (at your option) any later version. - -Tremulous is distributed in the hope that it will be -useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with Tremulous; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -=========================================================================== -*/ - -// cg_ptr.c -- post timeout restoration handling - - -#include "cg_local.h" - -#define PTRC_FILE "ptrc.cfg" - -/* -=============== -CG_ReadPTRCode - -Read a PTR code from disk -=============== -*/ -int CG_ReadPTRCode( void ) -{ - int len; - char text[ 16 ]; - fileHandle_t f; - - // load the file - len = trap_FS_FOpenFile( PTRC_FILE, &f, FS_READ ); - if( len < 0 ) - return 0; - - // should never happen - malformed write - if( len == 0 || len >= sizeof( text ) - 1 ) - { - trap_FS_FCloseFile( f ); - return 0; - } - - trap_FS_Read( text, len, f ); - text[ len ] = 0; - trap_FS_FCloseFile( f ); - - return atoi( text ); -} - -/* -=============== -CG_WritePTRCode - -Write a PTR code to disk -=============== -*/ -void CG_WritePTRCode( int code ) -{ - char text[ 16 ]; - fileHandle_t f; - - Com_sprintf( text, 16, "%d", code ); - - // open file - if( trap_FS_FOpenFile( PTRC_FILE, &f, FS_WRITE ) < 0 ) - return; - - // write the code - trap_FS_Write( text, strlen( text ), f ); - - trap_FS_FCloseFile( f ); -} diff --git a/src/cgame/cg_servercmds.c b/src/cgame/cg_servercmds.c index 63db2ffe..faa5a175 100644 --- a/src/cgame/cg_servercmds.c +++ b/src/cgame/cg_servercmds.c @@ -1235,37 +1235,6 @@ static void CG_PoisonCloud_f( void ) } } -/* -================= -CG_PTRRequest_f -================= -*/ -static void CG_PTRRequest_f( void ) -{ - trap_SendClientCommand( va( "ptrcverify %d", CG_ReadPTRCode( ) ) ); -} - -/* -================= -CG_PTRIssue_f -================= -*/ -static void CG_PTRIssue_f( void ) -{ - if( trap_Argc( ) == 2 ) - CG_WritePTRCode( atoi( CG_Argv( 1 ) ) ); -} - -/* -================= -CG_PTRConfirm_f -================= -*/ -static void CG_PTRConfirm_f( void ) -{ - trap_SendConsoleCommand( "menu ptrc_popmenu\n" ); -} - static void CG_GameCmds_f( void ) { int i; @@ -1291,9 +1260,6 @@ static consoleCommand_t svcommands[ ] = { "map_restart", CG_MapRestart }, { "poisoncloud", CG_PoisonCloud_f }, { "print", CG_Print_f }, - { "ptrcconfirm", CG_PTRConfirm_f }, - { "ptrcissue", CG_PTRIssue_f }, - { "ptrcrequest", CG_PTRRequest_f }, { "scores", CG_ParseScores }, { "serverclosemenus", CG_ServerCloseMenus_f }, { "servermenu", CG_ServerMenu_f }, diff --git a/src/game/g_active.c b/src/game/g_active.c index c2cc91bf..521d6765 100644 --- a/src/game/g_active.c +++ b/src/game/g_active.c @@ -1294,7 +1294,7 @@ void ClientThink_real( gentity_t *ent ) return; } - G_UpdatePTRConnection( client ); + G_namelog_update_score( client ); // check for inactivity timer, but never drop the local client of a non-dedicated server if( !ClientInactivityTimer( ent ) ) diff --git a/src/game/g_admin.c b/src/game/g_admin.c index f98750ff..34c11f18 100644 --- a/src/game/g_admin.c +++ b/src/game/g_admin.c @@ -196,7 +196,6 @@ g_admin_level_t *g_admin_levels = NULL; g_admin_admin_t *g_admin_admins = NULL; g_admin_ban_t *g_admin_bans = NULL; g_admin_command_t *g_admin_commands = NULL; -g_admin_namelog_t *g_admin_namelogs = NULL; void G_admin_register_cmds( void ) { @@ -899,75 +898,6 @@ qboolean G_admin_cmd_check( gentity_t *ent ) return qfalse; } -void G_admin_namelog_cleanup( ) -{ - g_admin_namelog_t *namelog, *n; - - for( namelog = g_admin_namelogs; namelog; namelog = n ) - { - n = namelog->next; - BG_Free( namelog ); - } -} - -void G_admin_namelog_update( gclient_t *client, qboolean disconnect ) -{ - int i; - g_admin_namelog_t *n, *p = NULL; - char n1[ MAX_NAME_LENGTH ]; - char n2[ MAX_NAME_LENGTH ]; - int clientNum = ( client - level.clients ); - - G_SanitiseString( client->pers.netname, n1, sizeof( n1 ) ); - for( n = g_admin_namelogs; n; p = n, n = n->next ) - { - if( disconnect && n->slot != clientNum ) - continue; - - if( !disconnect && n->slot != clientNum && n->slot != -1 ) - continue; - - if( !Q_stricmp( client->pers.guid, n->guid ) ) - { - for( i = 0; i < MAX_ADMIN_NAMELOG_NAMES && n->name[ i ][ 0 ]; i++ ) - { - G_SanitiseString( n->name[ i ], n2, sizeof( n2 ) ); - if( !strcmp( n1, n2 ) ) - break; - } - if( i == MAX_ADMIN_NAMELOG_NAMES ) - i = client->pers.nameChanges % MAX_ADMIN_NAMELOG_NAMES; - Q_strncpyz( n->name[ i ], client->pers.netname, sizeof( n->name[ i ] ) ); - - for( i = 0; i < MAX_ADMIN_NAMELOG_ADDRS && n->ip[ i ][ 0 ]; i++ ) - { - if( !Q_stricmp( client->pers.ip, n->ip[ i ] ) ) - break; - } - if( i == MAX_ADMIN_NAMELOG_ADDRS ) - i--; - Q_strncpyz( n->ip[ i ], client->pers.ip, sizeof( n->ip[ i ] ) ); - - n->slot = ( disconnect ) ? -1 : clientNum; - - // if this player is connecting, they are no longer banned - if( !disconnect ) - n->banned = qfalse; - - return; - } - } - n = BG_Alloc( sizeof( g_admin_namelog_t ) ); - Q_strncpyz( n->ip[ 0 ], client->pers.ip, sizeof( n->ip[ 0 ] ) ); - Q_strncpyz( n->guid, client->pers.guid, sizeof( n->guid ) ); - Q_strncpyz( n->name[ 0 ], client->pers.netname, sizeof( n->name[ 0 ] ) ); - n->slot = ( disconnect ) ? -1 : clientNum; - if( p ) - p->next = n; - else - g_admin_namelogs = n; -} - qboolean G_admin_readconfig( gentity_t *ent ) { g_admin_level_t *l = NULL; @@ -1511,7 +1441,7 @@ qboolean G_admin_ban( gentity_t *ent ) int netmask = -1; addr_t ip, cmp; qboolean ipmatch = qfalse; - g_admin_namelog_t *namelog, *match = NULL; + namelog_t *namelog, *match = NULL; if( trap_Argc() < 2 ) { @@ -1557,7 +1487,7 @@ qboolean G_admin_ban( gentity_t *ent ) { logmatches = 1; exactmatch = qtrue; - for( match = g_admin_namelogs; match->slot != i; match = match->next ); + for( match = level.namelogs; match->slot != i; match = match->next ); } } else if( G_AddressParse( search, &ip, &netmask ) ) @@ -1573,7 +1503,7 @@ qboolean G_admin_ban( gentity_t *ent ) ipmatch = qtrue; } - for( namelog = g_admin_namelogs; namelog && !exactmatch; namelog = namelog->next ) + for( namelog = level.namelogs; namelog && !exactmatch; namelog = namelog->next ) { // skip players in the namelog who have already been banned if( namelog->banned ) @@ -1581,7 +1511,7 @@ qboolean G_admin_ban( gentity_t *ent ) if( ipmatch ) { - for( i = 0; i < MAX_ADMIN_NAMELOG_ADDRS && namelog->ip[ i ][ 0 ]; i++ ) + for( i = 0; i < MAX_NAMELOG_ADDRS && namelog->ip[ i ][ 0 ]; i++ ) { if( G_AddressParse( namelog->ip[ i ], &cmp, NULL ) && G_AddressCompare( &ip, &cmp, netmask ) ) @@ -1602,7 +1532,7 @@ qboolean G_admin_ban( gentity_t *ent ) } else { - for( i = 0; i < MAX_ADMIN_NAMELOG_NAMES && namelog->name[ i ][ 0 ]; i++ ) + for( i = 0; i < MAX_NAMELOG_NAMES && namelog->name[ i ][ 0 ]; i++ ) { G_SanitiseString( namelog->name[ i ], n2, sizeof( n2 ) ); if( strstr( n2, s2 ) ) @@ -1624,21 +1554,21 @@ qboolean G_admin_ban( gentity_t *ent ) { ADMBP_begin(); ADMBP( "^3ban: ^7multiple recent clients match name, use IP or slot#:\n" ); - for( namelog = g_admin_namelogs; namelog; namelog = namelog->next ) + for( namelog = level.namelogs; namelog; namelog = namelog->next ) { - for( i = 0; i < MAX_ADMIN_NAMELOG_NAMES && namelog->name[ i ][ 0 ]; i++ ) + for( i = 0; i < MAX_NAMELOG_NAMES && namelog->name[ i ][ 0 ]; i++ ) { G_SanitiseString( namelog->name[ i ], n2, sizeof( n2 ) ); if( strstr( n2, s2 ) ) break; } - if( i < MAX_ADMIN_NAMELOG_NAMES && namelog->name[ i ][ 0 ] ) + if( i < MAX_NAMELOG_NAMES && namelog->name[ i ][ 0 ] ) { ADMBP( namelog->slot > -1 ? va( S_COLOR_YELLOW "%-2d" S_COLOR_WHITE, namelog->slot ) : "- " ); - for( i = 0; i < MAX_ADMIN_NAMELOG_NAMES && namelog->name[ i ][ 0 ]; i++ ) + for( i = 0; i < MAX_NAMELOG_NAMES && namelog->name[ i ][ 0 ]; i++ ) ADMBP( va( " %s" S_COLOR_WHITE, namelog->name[ i ] ) ); - for( i = 0; i < MAX_ADMIN_NAMELOG_ADDRS && namelog->ip[ i ][ 0 ]; i++ ) + for( i = 0; i < MAX_NAMELOG_ADDRS && namelog->ip[ i ][ 0 ]; i++ ) ADMBP( va( " %s", namelog->ip[ i ] ) ); ADMBP( "\n" ); } @@ -1666,7 +1596,8 @@ qboolean G_admin_ban( gentity_t *ent ) if( ipmatch ) { admin_create_ban( ent, - match->slot == -1 ? match->name[ 0 ] : + match->slot == -1 ? + match->name[ match->nameChanges % MAX_NAMELOG_NAMES ] : level.clients[ match->slot ].pers.netname, match->guid, search, @@ -1675,10 +1606,11 @@ qboolean G_admin_ban( gentity_t *ent ) else { // ban all IP addresses used by this player - for( i = 0; i < MAX_ADMIN_NAMELOG_ADDRS && match->ip[ i ][ 0 ]; i++ ) + for( i = 0; i < MAX_NAMELOG_ADDRS && match->ip[ i ][ 0 ]; i++ ) { admin_create_ban( ent, - match->slot == -1 ? match->name[ 0 ] : + match->slot == -1 ? + match->name[ match->nameChanges % MAX_NAMELOG_NAMES ] : level.clients[ match->slot ].pers.netname, match->guid, match->ip[ i ], @@ -1972,14 +1904,14 @@ qboolean G_admin_mute( gentity_t *ent ) return qfalse; } vic = &g_entities[ pids[ 0 ] ]; - if( vic->client->pers.muted == qtrue ) + if( vic->client->pers.namelog->muted ) { if( !Q_stricmp( command, "mute" ) ) { ADMP( "^3mute: ^7player is already muted\n" ); return qtrue; } - vic->client->pers.muted = qfalse; + vic->client->pers.namelog->muted = qfalse; CPx( pids[ 0 ], "cp \"^1You have been unmuted\"" ); AP( va( "print \"^3unmute: ^7%s^7 has been unmuted by %s\n\"", vic->client->pers.netname, @@ -1992,7 +1924,7 @@ qboolean G_admin_mute( gentity_t *ent ) ADMP( "^3unmute: ^7player is not currently muted\n" ); return qtrue; } - vic->client->pers.muted = qtrue; + vic->client->pers.namelog->muted = qtrue; CPx( pids[ 0 ], "cp \"^1You've been muted\"" ); AP( va( "print \"^3mute: ^7%s^7 has been muted by ^7%s\n\"", vic->client->pers.netname, @@ -2028,14 +1960,14 @@ qboolean G_admin_denybuild( gentity_t *ent ) return qfalse; } vic = &g_entities[ pids[ 0 ] ]; - if( vic->client->pers.denyBuild ) + if( vic->client->pers.namelog->denyBuild ) { if( !Q_stricmp( command, "denybuild" ) ) { ADMP( "^3denybuild: ^7player already has no building rights\n" ); return qtrue; } - vic->client->pers.denyBuild = qfalse; + vic->client->pers.namelog->denyBuild = qfalse; CPx( pids[ 0 ], "cp \"^1You've regained your building rights\"" ); AP( va( "print \"^3allowbuild: ^7building rights for ^7%s^7 restored by %s\n\"", @@ -2049,7 +1981,7 @@ qboolean G_admin_denybuild( gentity_t *ent ) ADMP( "^3allowbuild: ^7player already has building rights\n" ); return qtrue; } - vic->client->pers.denyBuild = qtrue; + vic->client->pers.namelog->denyBuild = qtrue; vic->client->ps.stats[ STAT_BUILDABLE ] = BA_NONE; CPx( pids[ 0 ], "cp \"^1You've lost your building rights\"" ); AP( va( @@ -2205,8 +2137,8 @@ qboolean G_admin_listplayers( gentity_t *ent ) c = COLOR_WHITE; } - muted = p->pers.muted ? 'M' : ' '; - denied = p->pers.denyBuild ? 'B' : ' '; + muted = p->pers.namelog->muted ? 'M' : ' '; + denied = p->pers.namelog->denyBuild ? 'B' : ' '; l = d; registeredname = NULL; @@ -2671,8 +2603,8 @@ qboolean G_admin_rename( gentity_t *ent ) ADMP( va( "^3rename: ^7%s\n", err ) ); return qfalse; } - victim->client->pers.nameChanges--; - victim->client->pers.nameChangeTime = 0; + victim->client->pers.namelog->nameChanges--; + victim->client->pers.namelog->nameChangeTime = 0; trap_GetUserinfo( pids[ 0 ], userinfo, sizeof( userinfo ) ); AP( va( "print \"^3rename: ^7%s^7 has been renamed to %s^7 by %s\n\"", victim->client->pers.netname, @@ -2790,7 +2722,7 @@ qboolean G_admin_namelog( gentity_t *ent ) addr_t a, b; int mask = -1; qboolean ipmatch = qfalse; - g_admin_namelog_t *n; + namelog_t *n; if( trap_Argc() > 1 ) { @@ -2800,35 +2732,35 @@ qboolean G_admin_namelog( gentity_t *ent ) G_SanitiseString( search, s2, sizeof( s2 ) ); } ADMBP_begin(); - for( n = g_admin_namelogs; n; n = n->next ) + for( n = level.namelogs; n; n = n->next ) { if( ipmatch ) { - for( i = 0; i < MAX_ADMIN_NAMELOG_ADDRS && n->ip[ i ][ 0 ]; i++ ) + for( i = 0; i < MAX_NAMELOG_ADDRS && n->ip[ i ][ 0 ]; i++ ) { if( G_AddressParse( n->ip[ i ], &b, NULL ) && G_AddressCompare( &a, &b, mask ) ) break; } - if( i == MAX_ADMIN_NAMELOG_ADDRS || !n->ip[ i ][ 0 ] ) + if( i == MAX_NAMELOG_ADDRS || !n->ip[ i ][ 0 ] ) continue; } else if( search[ 0 ] ) { - for( i = 0; i < MAX_ADMIN_NAMELOG_NAMES && n->name[ i ][ 0 ]; i++ ) + for( i = 0; i < MAX_NAMELOG_NAMES && n->name[ i ][ 0 ]; i++ ) { G_SanitiseString( n->name[ i ], n2, sizeof( n2 ) ); if( strstr( n2, s2 ) ) break; } - if( i == MAX_ADMIN_NAMELOG_NAMES || !n->name[ i ][ 0 ] ) + if( i == MAX_NAMELOG_NAMES || !n->name[ i ][ 0 ] ) continue; } printed++; ADMBP( ( n->slot > -1 ) ? va( "^3%-2d", n->slot ) : "- " ); - for( i = 0; i < MAX_ADMIN_NAMELOG_ADDRS && n->ip[ i ][ 0 ]; i++ ) + for( i = 0; i < MAX_NAMELOG_ADDRS && n->ip[ i ][ 0 ]; i++ ) ADMBP( va( " %s", n->ip[ i ] ) ); - for( i = 0; i < MAX_ADMIN_NAMELOG_NAMES && n->name[ i ][ 0 ]; i++ ) + for( i = 0; i < MAX_NAMELOG_NAMES && n->name[ i ][ 0 ]; i++ ) ADMBP( va( " '%s^7'", n->name[ i ] ) ); ADMBP( "\n" ); } @@ -2914,7 +2846,7 @@ void G_admin_print( gentity_t *ent, char *m ) } } -void G_admin_buffer_begin() +void G_admin_buffer_begin( void ) { g_bfb[ 0 ] = '\0'; } @@ -2936,7 +2868,7 @@ void G_admin_buffer_print( gentity_t *ent, char *m ) } -void G_admin_cleanup() +void G_admin_cleanup( void ) { g_admin_level_t *l; g_admin_admin_t *a; diff --git a/src/game/g_admin.h b/src/game/g_admin.h index 783207d9..bc4158f5 100644 --- a/src/game/g_admin.h +++ b/src/game/g_admin.h @@ -31,8 +31,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #define ADMBP_begin() G_admin_buffer_begin() #define ADMBP_end() G_admin_buffer_end(ent) -#define MAX_ADMIN_NAMELOG_NAMES 5 -#define MAX_ADMIN_NAMELOG_ADDRS 5 #define MAX_ADMIN_FLAG_LEN 20 #define MAX_ADMIN_FLAGS 1024 #define MAX_ADMIN_CMD_LEN 20 @@ -124,17 +122,6 @@ typedef struct g_admin_command } g_admin_command_t; -typedef struct g_admin_namelog -{ - struct g_admin_namelog *next; - char name[ MAX_ADMIN_NAMELOG_NAMES ][ MAX_NAME_LENGTH ]; - char ip[ MAX_ADMIN_NAMELOG_ADDRS ][ 40 ]; - char guid[ 33 ]; - int slot; - qboolean banned; -} -g_admin_namelog_t; - void G_admin_register_cmds( void ); void G_admin_unregister_cmds( void ); void G_admin_cmdlist( gentity_t *ent ); @@ -144,7 +131,6 @@ qboolean G_admin_cmd_check( gentity_t *ent ); qboolean G_admin_readconfig( gentity_t *ent ); qboolean G_admin_permission( gentity_t *ent, const char *flag ); qboolean G_admin_name_check( gentity_t *ent, char *name, char *err, int len ); -void G_admin_namelog_update( gclient_t *ent, qboolean disconnect ); g_admin_admin_t *G_admin_admin( const char *guid ); void G_admin_authlog( gentity_t *ent ); @@ -181,6 +167,5 @@ void G_admin_buffer_end( gentity_t *ent ); void G_admin_duration( int secs, char *duration, int dursize ); void G_admin_cleanup( void ); -void G_admin_namelog_cleanup( void ); #endif /* ifndef _G_ADMIN_H */ diff --git a/src/game/g_client.c b/src/game/g_client.c index b6f1ab61..731230b1 100644 --- a/src/game/g_client.c +++ b/src/game/g_client.c @@ -1013,8 +1013,8 @@ void ClientUserinfoChanged( int clientNum ) if( strcmp( oldname, newname ) ) { - if( client->pers.nameChangeTime && - level.time - client->pers.nameChangeTime <= + if( client->pers.namelog->nameChangeTime && + level.time - client->pers.namelog->nameChangeTime <= g_minNameChangePeriod.value * 1000 ) { trap_SendServerCommand( ent - g_entities, va( @@ -1023,14 +1023,14 @@ void ClientUserinfoChanged( int clientNum ) revertName = qtrue; } else if( g_maxNameChanges.integer > 0 && - client->pers.nameChanges >= g_maxNameChanges.integer ) + client->pers.namelog->nameChanges >= g_maxNameChanges.integer ) { trap_SendServerCommand( ent - g_entities, va( "print \"Maximum name changes reached (g_maxNameChanges = %d)\n\"", g_maxNameChanges.integer ) ); revertName = qtrue; } - else if( client->pers.muted ) + else if( client->pers.namelog->muted ) { trap_SendServerCommand( ent - g_entities, "print \"You cannot change your name while you are muted\n\"" ); @@ -1053,28 +1053,22 @@ void ClientUserinfoChanged( int clientNum ) { Q_strncpyz( client->pers.netname, newname, sizeof( client->pers.netname ) ); + G_namelog_update_name( client ); if( client->pers.connected == CON_CONNECTED ) { - client->pers.nameChangeTime = level.time; - client->pers.nameChanges++; - } - } - } + client->pers.namelog->nameChangeTime = level.time; + client->pers.namelog->nameChanges++; - if( client->sess.spectatorState == SPECTATOR_SCOREBOARD ) - Q_strncpyz( client->pers.netname, "scoreboard", sizeof( client->pers.netname ) ); - - if( *oldname ) - { - if( strcmp( oldname, client->pers.netname ) ) - { - trap_SendServerCommand( -1, va( "print \"%s" S_COLOR_WHITE - " renamed to %s" S_COLOR_WHITE "\n\"", oldname, client->pers.netname ) ); - G_LogPrintf( "ClientRename: %i [%s] (%s) \"%s^7\" -> \"%s^7\" \"%c%s%c^7\"\n", + } + if( *oldname ) + { + trap_SendServerCommand( -1, va( "print \"%s" S_COLOR_WHITE + " renamed to %s\n\"", oldname, client->pers.netname ) ); + G_LogPrintf( "ClientRename: %i [%s] (%s) \"%s^7\" -> \"%s^7\" \"%c%s%c^7\"\n", clientNum, client->pers.ip, client->pers.guid, oldname, client->pers.netname, DECOLOR_OFF, client->pers.netname, DECOLOR_ON ); - G_admin_namelog_update( client, qfalse ); + } } } @@ -1277,6 +1271,7 @@ char *ClientConnect( int clientNum, qboolean firstTime ) G_ReadSessionData( client ); // get and distribute relevent paramters + G_namelog_connect( client ); ClientUserinfoChanged( clientNum ); G_LogPrintf( "ClientConnect: %i [%s] (%s) \"%s^7\" \"%c%s%c^7\"\n", clientNum, client->pers.ip, client->pers.guid, @@ -1293,7 +1288,6 @@ char *ClientConnect( int clientNum, qboolean firstTime ) // count current clients and rank for scoreboard CalculateRanks( ); - G_admin_namelog_update( client, qfalse ); // if this is after !restart keepteams or !restart switchteams, apply said selection @@ -1352,11 +1346,7 @@ void ClientBegin( int clientNum ) trap_SendServerCommand( -1, va( "print \"%s" S_COLOR_WHITE " entered the game\n\"", client->pers.netname ) ); - // name can change between ClientConnect() and ClientBegin() - G_admin_namelog_update( client, qfalse ); - - // request the clients PTR code - trap_SendServerCommand( ent - g_entities, "ptrcrequest" ); + G_namelog_restore( client ); G_LogPrintf( "ClientBegin: %i\n", clientNum ); @@ -1708,7 +1698,7 @@ void ClientDisconnect( int clientNum ) if( !ent->client ) return; - G_admin_namelog_update( ent->client, qtrue ); + G_namelog_disconnect( ent->client ); G_LeaveTeam( ent ); G_Vote( ent, TEAM_NONE, qfalse ); @@ -1727,9 +1717,6 @@ void ClientDisconnect( int clientNum ) tent->s.clientNum = ent->s.clientNum; } - if( ent->client->pers.connection ) - ent->client->pers.connection->clientNum = -1; - G_LogPrintf( "ClientDisconnect: %i [%s] (%s) \"%s^7\"\n", clientNum, ent->client->pers.ip, ent->client->pers.guid, ent->client->pers.netname ); diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c index bf773fe5..9e864106 100644 --- a/src/game/g_cmds.c +++ b/src/game/g_cmds.c @@ -1076,7 +1076,7 @@ void Cmd_CallVote_f( gentity_t *ent ) { if( !Q_stricmp( vote, "mute" ) ) { - if( level.clients[ clientNum ].pers.muted ) + if( level.clients[ clientNum ].pers.namelog->muted ) { trap_SendServerCommand( ent-g_entities, va( "print \"%s: player is already muted\n\"", cmd ) ); @@ -1091,7 +1091,7 @@ void Cmd_CallVote_f( gentity_t *ent ) } else if( !Q_stricmp( vote, "unmute" ) ) { - if( !level.clients[ clientNum ].pers.muted ) + if( !level.clients[ clientNum ].pers.namelog->muted ) { trap_SendServerCommand( ent-g_entities, va( "print \"%s: player is not currently muted\n\"", cmd ) ); @@ -1191,7 +1191,7 @@ void Cmd_CallVote_f( gentity_t *ent ) } else if( !Q_stricmp( vote, "denybuild" ) ) { - if( level.clients[ clientNum ].pers.denyBuild ) + if( level.clients[ clientNum ].pers.namelog->denyBuild ) { trap_SendServerCommand( ent-g_entities, va( "print \"%s: player already lost building rights\n\"", cmd ) ); @@ -1206,7 +1206,7 @@ void Cmd_CallVote_f( gentity_t *ent ) } else if( !Q_stricmp( vote, "allowbuild" ) ) { - if( !level.clients[ clientNum ].pers.denyBuild ) + if( !level.clients[ clientNum ].pers.namelog->denyBuild ) { trap_SendServerCommand( ent-g_entities, va( "print \"%s: player already has building rights\n\"", cmd ) ); @@ -1597,7 +1597,7 @@ void Cmd_Destroy_f( gentity_t *ent ) qboolean deconstruct = qtrue; qboolean lastSpawn = qfalse; - if( ent->client->pers.denyBuild ) + if( ent->client->pers.namelog->denyBuild ) { G_TriggerMenu( ent->client->ps.clientNum, MN_B_REVOKED ); return; @@ -2168,7 +2168,7 @@ void Cmd_Build_f( gentity_t *ent ) vec3_t origin; team_t team; - if( ent->client->pers.denyBuild ) + if( ent->client->pers.namelog->denyBuild ) { G_TriggerMenu( ent->client->ps.clientNum, MN_B_REVOKED ); return; @@ -2579,100 +2579,6 @@ void Cmd_FollowCycle_f( gentity_t *ent ) G_FollowNewClient( ent, dir ); } -/* -================= -Cmd_PTRCVerify_f - -Check a PTR code is valid -================= -*/ -void Cmd_PTRCVerify_f( gentity_t *ent ) -{ - connectionRecord_t *connection; - char s[ MAX_TOKEN_CHARS ] = { 0 }; - int code; - - trap_Argv( 1, s, sizeof( s ) ); - - if( !s[ 0 ] ) - return; - - code = atoi( s ); - - if( G_VerifyPTRC( code ) ) - { - connection = G_FindConnectionForCode( code ); - - // valid code - if( connection->clientTeam != TEAM_NONE ) - trap_SendServerCommand( ent->client->ps.clientNum, "ptrcconfirm" ); - - // restore mapping - ent->client->pers.connection = connection; - } - else - { - // invalid code -- generate a new one - connection = G_GenerateNewConnection( ent->client ); - - if( connection ) - { - trap_SendServerCommand( ent->client->ps.clientNum, - va( "ptrcissue %d", connection->ptrCode ) ); - } - } -} - -/* -================= -Cmd_PTRCRestore_f - -Restore against a PTR code -================= -*/ -void Cmd_PTRCRestore_f( gentity_t *ent ) -{ - char s[ MAX_TOKEN_CHARS ] = { 0 }; - int code; - connectionRecord_t *connection; - - trap_Argv( 1, s, sizeof( s ) ); - - if( !s[ 0 ] ) - return; - - code = atoi( s ); - - if( G_VerifyPTRC( code ) ) - { - if( ent->client->pers.joinedATeam ) - { - trap_SendServerCommand( ent - g_entities, - "print \"You cannot use a PTR code after joining a team\n\"" ); - } - else - { - // valid code - connection = G_FindConnectionForCode( code ); - - if( connection ) - { - // set the correct team - G_ChangeTeam( ent, connection->clientTeam ); - - // set the correct credit - ent->client->pers.credit = 0; - G_AddCreditToClient( ent->client, connection->clientCredit, qtrue ); - } - } - } - else - { - trap_SendServerCommand( ent - g_entities, - va( "print \"'%d' is not a valid PTR code\n\"", code ) ); - } -} - static void Cmd_Ignore_f( gentity_t *ent ) { int pids[ MAX_CLIENTS ]; @@ -2957,8 +2863,6 @@ commands_t cmds[ ] = { { "mt", CMD_MESSAGE|CMD_INTERMISSION, Cmd_PrivateMessage_f }, { "noclip", CMD_CHEAT_TEAM, Cmd_Noclip_f }, { "notarget", CMD_CHEAT|CMD_TEAM|CMD_LIVING, Cmd_Notarget_f }, - { "ptrcrestore", CMD_SPEC, Cmd_PTRCRestore_f }, - { "ptrcverify", CMD_SPEC, Cmd_PTRCVerify_f }, { "reload", CMD_HUMAN|CMD_LIVING, Cmd_Reload_f }, { "say", CMD_MESSAGE|CMD_INTERMISSION, Cmd_Say_f }, { "say_area", CMD_MESSAGE|CMD_TEAM|CMD_LIVING, Cmd_SayArea_f }, @@ -3016,7 +2920,7 @@ void ClientCommand( int clientNum ) return; } - if( command->cmdFlags & CMD_MESSAGE && ( ent->client->pers.muted || + if( command->cmdFlags & CMD_MESSAGE && ( ent->client->pers.namelog->muted || G_FloodLimited( ent ) ) ) return; diff --git a/src/game/g_local.h b/src/game/g_local.h index 71121569..6ace8093 100644 --- a/src/game/g_local.h +++ b/src/game/g_local.h @@ -272,15 +272,28 @@ typedef struct clientList_t ignoreList; } clientSession_t; -// data to store details of clients that have abnormally disconnected -typedef struct connectionRecord_s +// namelog +#define MAX_NAMELOG_NAMES 5 +#define MAX_NAMELOG_ADDRS 5 +typedef struct namelog_s { - int clientNum; - team_t clientTeam; - int clientCredit; + struct namelog_s *next; + char name[ MAX_NAMELOG_NAMES ][ MAX_NAME_LENGTH ]; + char ip[ MAX_NAMELOG_ADDRS ][ 40 ]; + char guid[ 33 ]; + int slot; + qboolean banned; - int ptrCode; -} connectionRecord_t; + int nameChangeTime; + int nameChanges; + + qboolean muted; + qboolean denyBuild; + + int score; + int credits; + team_t team; +} namelog_t; // client data that stays across multiple respawns, but is cleared // on each level change or team change at ClientBegin() @@ -306,9 +319,7 @@ typedef struct weapon_t humanItemSelection; // humans have a starting item team_t teamSelection; // player team (copied to ps.stats[ STAT_TEAM ]) - int teamChangeTime; // level.time of last team change - qboolean joinedATeam; // used to tell when a PTR code is valid - connectionRecord_t *connection; + namelog_t *namelog; g_admin_admin_t *admin; int aliveSeconds; // time player has been alive in seconds @@ -329,8 +340,6 @@ typedef struct vec3_t lastDeathLocation; char guid[ 33 ]; char ip[ 40 ]; - qboolean muted; - qboolean denyBuild; char voice[ MAX_VOICE_NAME_LEN ]; qboolean useUnlagged; // keep track of other players' info for tinfo @@ -627,6 +636,8 @@ typedef struct emoticon_t emoticons[ MAX_EMOTICONS ]; int emoticonCount; + + namelog_t *namelogs; } level_locals_t; #define CMD_CHEAT 0x0001 @@ -1012,15 +1023,15 @@ qboolean G_MapExists( char *name ); void G_ClearRotationStack( void ); // -// g_ptr.c +// g_namelog.c // -void G_UpdatePTRConnection( gclient_t *client ); -connectionRecord_t *G_GenerateNewConnection( gclient_t *client ); -qboolean G_VerifyPTRC( int code ); -void G_ResetPTRConnections( void ); -connectionRecord_t *G_FindConnectionForCode( int code ); -void G_DeletePTRConnection( connectionRecord_t *connection ); +void G_namelog_connect( gclient_t *client ); +void G_namelog_disconnect( gclient_t *client ); +void G_namelog_restore( gclient_t *client ); +void G_namelog_update_score( gclient_t *client ); +void G_namelog_update_name( gclient_t *client ); +void G_namelog_cleanup( void ); //some maxs #define MAX_FILEPATH 144 diff --git a/src/game/g_main.c b/src/game/g_main.c index 0a2a37bd..6766e9ef 100644 --- a/src/game/g_main.c +++ b/src/game/g_main.c @@ -627,8 +627,6 @@ void G_InitGame( int levelTime, int randomSeed, int restart ) G_CountSpawns( ); G_UpdateTeamConfigStrings( ); - - G_ResetPTRConnections( ); if( g_lockTeamsAtStart.integer ) { @@ -679,7 +677,7 @@ void G_ShutdownGame( int restart ) G_WriteSessionData( ); G_admin_cleanup( ); - G_admin_namelog_cleanup( ); + G_namelog_cleanup( ); G_UnregisterCommands( ); G_ShutdownMapRotations( ); diff --git a/src/game/g_namelog.c b/src/game/g_namelog.c new file mode 100644 index 00000000..2da09cf7 --- /dev/null +++ b/src/game/g_namelog.c @@ -0,0 +1,111 @@ +/* +=========================================================================== +Copyright (C) 2010 Darklegion Development + +This file is part of Tremulous. + +Tremulous is free software; you can redistribute it +and/or modify it under the terms of the GNU General Public License as +published by the Free Software Foundation; either version 2 of the License, +or (at your option) any later version. + +Tremulous is distributed in the hope that it will be +useful, but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with Tremulous; if not, write to the Free Software +Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +=========================================================================== +*/ + +#include "g_local.h" + +void G_namelog_cleanup( void ) +{ + namelog_t *namelog, *n; + + for( namelog = level.namelogs; namelog; namelog = n ) + { + n = namelog->next; + BG_Free( namelog ); + } +} + +void G_namelog_connect( gclient_t *client ) +{ + namelog_t *n, *p = NULL; + int i; + + for( n = level.namelogs; n; p = n, n = n->next ) + { + if( n->slot != -1 ) + continue; + if( !Q_stricmp( client->pers.guid, n->guid ) ) + break; + } + if( !n ) + { + n = BG_Alloc( sizeof( namelog_t ) ); + strcpy( n->guid, client->pers.guid ); + if( p ) + p->next = n; + else + level.namelogs = n; + } + client->pers.namelog = n; + n->slot = client - level.clients; + n->banned = qfalse; + + G_namelog_update_name( client ); + + for( i = 0; i < MAX_NAMELOG_ADDRS && n->ip[ i ][ 0 ]; i++ ) + if( !strcmp( n->ip[ i ], client->pers.ip ) ) + return; + if( i == MAX_NAMELOG_ADDRS ) + i--; + strcpy( n->ip[ i ], client->pers.ip ); +} + +void G_namelog_disconnect( gclient_t *client ) +{ + client->pers.namelog->slot = -1; + client->pers.namelog = NULL; +} + +void G_namelog_update_score( gclient_t *client ) +{ + namelog_t *n = client->pers.namelog; + + n->team = client->pers.teamSelection; + n->score = client->ps.persistant[ PERS_SCORE ]; + n->credits = client->pers.credit; +} + +void G_namelog_update_name( gclient_t *client ) +{ + int i; + char n1[ MAX_NAME_LENGTH ], n2[ MAX_NAME_LENGTH ]; + namelog_t *n = client->pers.namelog; + + G_SanitiseString( client->pers.netname, n1, sizeof( n1 ) ); + for( i = 0; i < MAX_NAMELOG_NAMES && n->name[ i ][ 0 ]; i++ ) + { + G_SanitiseString( n->name[ i ], n2, sizeof( n2 ) ); + if( !strcmp( n1, n2 ) ) + return; + } + strcpy( n->name[ n->nameChanges % MAX_NAMELOG_NAMES ], client->pers.netname ); +} + +void G_namelog_restore( gclient_t *client ) +{ + namelog_t *n = client->pers.namelog; + + G_ChangeTeam( g_entities + n->slot, n->team ); + client->ps.persistant[ PERS_SCORE ] = n->score; + client->ps.persistant[ PERS_CREDIT ] = 0; + G_AddCreditToClient( client, n->credits, qfalse ); +} + diff --git a/src/game/g_ptr.c b/src/game/g_ptr.c deleted file mode 100644 index ac296ea4..00000000 --- a/src/game/g_ptr.c +++ /dev/null @@ -1,174 +0,0 @@ -/* -=========================================================================== -Copyright (C) 1999-2005 Id Software, Inc. -Copyright (C) 2000-2009 Darklegion Development - -This file is part of Tremulous. - -Tremulous is free software; you can redistribute it -and/or modify it under the terms of the GNU General Public License as -published by the Free Software Foundation; either version 2 of the License, -or (at your option) any later version. - -Tremulous is distributed in the hope that it will be -useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with Tremulous; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -=========================================================================== -*/ - -// g_ptr.c -- post timeout restoration handling - -#include "g_local.h" - -static connectionRecord_t connections[ MAX_CLIENTS ]; - -/* -=============== -G_CheckForUniquePTRC - -Callback to detect ptrc clashes -=============== -*/ -static qboolean G_CheckForUniquePTRC( int code ) -{ - int i; - - if( code == 0 ) - return qfalse; - - for( i = 0; i < MAX_CLIENTS; i++ ) - { - if( connections[ i ].ptrCode == code ) - return qfalse; - } - - return qtrue; -} - -/* -=============== -G_UpdatePTRConnection - -Update the data in a connection record -=============== -*/ -void G_UpdatePTRConnection( gclient_t *client ) -{ - if( client && client->pers.connection ) - { - client->pers.connection->clientTeam = client->pers.teamSelection; - client->pers.connection->clientCredit = client->pers.credit; - } -} - -/* -=============== -G_GenerateNewConnection - -Generates a new connection -=============== -*/ -connectionRecord_t *G_GenerateNewConnection( gclient_t *client ) -{ - int code = 0; - int i; - - // there is a very very small possibility that this - // will loop infinitely - do - { - code = rand( ); - } while( !G_CheckForUniquePTRC( code ) ); - - for( i = 0; i < MAX_CLIENTS; i++ ) - { - //found an unused slot - if( !connections[ i ].ptrCode ) - { - connections[ i ].ptrCode = code; - connections[ i ].clientNum = client->ps.clientNum; - client->pers.connection = &connections[ i ]; - G_UpdatePTRConnection( client ); - - return &connections[ i ]; - } - } - - return NULL; -} - -/* -=============== -G_VerifyPTRC - -Check a PTR code for validity -=============== -*/ -qboolean G_VerifyPTRC( int code ) -{ - int i; - - if( code == 0 ) - return qfalse; - - for( i = 0; i < MAX_CLIENTS; i++ ) - { - if( connections[ i ].ptrCode == code ) - return qtrue; - } - - return qfalse; -} - -/* -=============== -G_FindConnectionForCode - -Finds a connection for a given code -=============== -*/ -connectionRecord_t *G_FindConnectionForCode( int code ) -{ - int i; - - if( code == 0 ) - return NULL; - - for( i = 0; i < MAX_CLIENTS; i++ ) - { - if( connections[ i ].ptrCode == code ) - return &connections[ i ]; - } - - return NULL; -} - -/* -=============== -G_DeletePTRConnection - -Finds a connection and deletes it -=============== -*/ -void G_DeletePTRConnection( connectionRecord_t *connection ) -{ - if( connection ) - memset( connection, 0, sizeof( connectionRecord_t ) ); -} - -/* -=============== -G_ResetPTRConnections - -Invalidate any existing codes -=============== -*/ -void G_ResetPTRConnections( void ) -{ - memset( connections, 0, sizeof( connectionRecord_t ) * MAX_CLIENTS ); -} diff --git a/src/game/g_team.c b/src/game/g_team.c index dec34e9a..b0709949 100644 --- a/src/game/g_team.c +++ b/src/game/g_team.c @@ -201,6 +201,8 @@ void G_LeaveTeam( gentity_t *self ) else if( ent->s.eType == ET_MISSILE && ent->r.ownerNum == self->s.number ) G_FreeEntity( ent ); } + + G_namelog_update_score( self->client ); } /* @@ -219,8 +221,6 @@ void G_ChangeTeam( gentity_t *ent, team_t newTeam ) ent->client->pers.teamSelection = newTeam; ent->client->pers.classSelection = PCL_NONE; ClientSpawn( ent, NULL, NULL, NULL ); - ent->client->pers.joinedATeam = qtrue; - ent->client->pers.teamChangeTime = level.time; if( oldTeam == TEAM_HUMANS && newTeam == TEAM_ALIENS ) { @@ -247,6 +247,7 @@ void G_ChangeTeam( gentity_t *ent, team_t newTeam ) G_LogPrintf( "ChangeTeam: %d %s: %s" S_COLOR_WHITE " switched teams\n", ent - g_entities, BG_TeamName( newTeam ), ent->client->pers.netname ); + G_namelog_update_score( ent->client ); TeamplayInfoMessage( ent ); } diff --git a/src/ui/ui_main.c b/src/ui/ui_main.c index f9c2d7f4..22b35637 100644 --- a/src/ui/ui_main.c +++ b/src/ui/ui_main.c @@ -3018,28 +3018,6 @@ static void UI_RunMenuScript( char **args ) if( ( cmd = uiInfo.humanBuildList[ uiInfo.humanBuildIndex ].cmd ) ) trap_Cmd_ExecuteText( EXEC_APPEND, cmd ); } - else if( Q_stricmp( name, "PTRCRestore" ) == 0 ) - { - int len; - char text[ 16 ]; - fileHandle_t f; - char command[ 32 ]; - - // load the file - len = trap_FS_FOpenFile( "ptrc.cfg", &f, FS_READ ); - - if( len > 0 && ( len < sizeof( text ) - 1 ) ) - { - trap_FS_Read( text, len, f ); - text[ len ] = 0; - - Com_sprintf( command, 32, "ptrcrestore %s", text ); - - trap_Cmd_ExecuteText( EXEC_APPEND, command ); - } - if( len > -1 ) - trap_FS_FCloseFile( f ); - } else if( Q_stricmp( name, "Say" ) == 0 ) { char buffer[ MAX_CVAR_VALUE_STRING ]; |