diff options
-rw-r--r-- | src/game/g_admin.c | 11 | ||||
-rw-r--r-- | src/game/g_local.h | 1 | ||||
-rw-r--r-- | src/game/g_namelog.c | 16 |
3 files changed, 15 insertions, 13 deletions
diff --git a/src/game/g_admin.c b/src/game/g_admin.c index 306b1646..317f1eeb 100644 --- a/src/game/g_admin.c +++ b/src/game/g_admin.c @@ -1609,7 +1609,7 @@ qboolean G_admin_ban( gentity_t *ent ) AP( va( "print \"^3ban:^7 %s^7 has been banned by %s^7 " "duration: %s, reason: %s\n\"", - match->name[ match->nameChanges % MAX_NAMELOG_NAMES ], + match->name[ match->nameOffset % MAX_NAMELOG_NAMES ], ( ent ) ? ent->client->pers.netname : "console", duration, ( *reason ) ? reason : "banned by admin" ) ); @@ -1618,7 +1618,7 @@ qboolean G_admin_ban( gentity_t *ent ) { admin_create_ban( ent, match->slot == -1 ? - match->name[ match->nameChanges % MAX_NAMELOG_NAMES ] : + match->name[ match->nameOffset % MAX_NAMELOG_NAMES ] : level.clients[ match->slot ].pers.netname, match->guid, &ip, @@ -1631,7 +1631,7 @@ qboolean G_admin_ban( gentity_t *ent ) { admin_create_ban( ent, match->slot == -1 ? - match->name[ match->nameChanges % MAX_NAMELOG_NAMES ] : + match->name[ match->nameOffset % MAX_NAMELOG_NAMES ] : level.clients[ match->slot ].pers.netname, match->guid, &match->ip[ i ], @@ -2779,7 +2779,8 @@ qboolean G_admin_namelog( gentity_t *ent ) for( i = 0; i < MAX_NAMELOG_ADDRS && n->ip[ i ].str[ 0 ]; i++ ) ADMBP( va( " %s", n->ip[ i ].str ) ); for( i = 0; i < MAX_NAMELOG_NAMES && n->name[ i ][ 0 ]; i++ ) - ADMBP( va( S_COLOR_WHITE " '%s" S_COLOR_WHITE "'", n->name[ i ] ) ); + ADMBP( va( S_COLOR_WHITE " '%s" S_COLOR_WHITE "'%s", n->name[ i ], + ( i == n->nameOffset % MAX_NAMELOG_NAMES ) ? "*" : "" ) ); ADMBP( "\n" ); } ADMBP( va( "^3namelog:^7 %d recent clients found\n", printed ) ); @@ -2946,7 +2947,7 @@ qboolean G_admin_buildlog( gentity_t *ent ) fates[ log->fate ], log->actor ? " by " : "", log->actor ? - log->actor->name[ log->actor->nameChanges % MAX_NAMELOG_NAMES ] : + log->actor->name[ log->actor->nameOffset % MAX_NAMELOG_NAMES ] : "" ) ); } ADMBP( va( "^3buildlog: ^7showing %d build logs %d - %d of %d - %d. %s\n", diff --git a/src/game/g_local.h b/src/game/g_local.h index a55561ea..77017acd 100644 --- a/src/game/g_local.h +++ b/src/game/g_local.h @@ -283,6 +283,7 @@ typedef struct namelog_s int slot; qboolean banned; + int nameOffset; int nameChangeTime; int nameChanges; int voteCount; diff --git a/src/game/g_namelog.c b/src/game/g_namelog.c index 9d9f3b83..af437814 100644 --- a/src/game/g_namelog.c +++ b/src/game/g_namelog.c @@ -59,7 +59,7 @@ void G_namelog_connect( gclient_t *client ) n->slot = client - level.clients; n->banned = qfalse; - newname = n->name[ n->nameChanges % MAX_NAMELOG_NAMES ]; + newname = n->name[ n->nameOffset % MAX_NAMELOG_NAMES ]; // If they're muted, copy in their last known name - this will stop people // reconnecting to get around the name change protection. if( n->muted && G_admin_name_check( &g_entities[ n->slot ], @@ -95,18 +95,18 @@ void G_namelog_update_score( gclient_t *client ) 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++ ) + if( n->name[ n->nameOffset % MAX_NAMELOG_NAMES ][ 0 ] ) { - G_SanitiseString( n->name[ i ], n2, sizeof( n2 ) ); - if( !strcmp( n1, n2 ) ) - return; + G_SanitiseString( client->pers.netname, n1, sizeof( n1 ) ); + G_SanitiseString( n->name[ n->nameOffset % MAX_NAMELOG_NAMES ], + n2, sizeof( n2 ) ); + if( strcmp( n1, n2 ) != 0 ) + n->nameOffset++; } - strcpy( n->name[ n->nameChanges % MAX_NAMELOG_NAMES ], client->pers.netname ); + strcpy( n->name[ n->nameOffset % MAX_NAMELOG_NAMES ], client->pers.netname ); } void G_namelog_restore( gclient_t *client ) |