diff options
author | M. Kristall <mkpdev@gmail.com> | 2011-01-07 03:27:12 +0000 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2013-01-03 00:17:50 +0000 |
commit | 54f63a7177674f26e2df2f48dda8d26bf71eb574 (patch) | |
tree | e78ce9eca38737f52e5df1ea29285d8bfcc315e0 | |
parent | 26aa169f3de39f5eb478da14789e0e4807aaffbb (diff) |
* Pointless refactor to reduce the number of ops
-rw-r--r-- | src/game/g_admin.c | 12 | ||||
-rw-r--r-- | src/game/g_namelog.c | 10 |
2 files changed, 11 insertions, 11 deletions
diff --git a/src/game/g_admin.c b/src/game/g_admin.c index baed7026..c30aa546 100644 --- a/src/game/g_admin.c +++ b/src/game/g_admin.c @@ -1673,7 +1673,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->nameOffset % MAX_NAMELOG_NAMES ], + match->name[ match->nameOffset ], ( ent ) ? ent->client->pers.netname : "console", duration, ( *reason ) ? reason : "banned by admin" ) ); @@ -1682,7 +1682,7 @@ qboolean G_admin_ban( gentity_t *ent ) { admin_create_ban( ent, match->slot == -1 ? - match->name[ match->nameOffset % MAX_NAMELOG_NAMES ] : + match->name[ match->nameOffset ] : level.clients[ match->slot ].pers.netname, match->guid, &ip, @@ -1695,7 +1695,7 @@ qboolean G_admin_ban( gentity_t *ent ) { admin_create_ban( ent, match->slot == -1 ? - match->name[ match->nameOffset % MAX_NAMELOG_NAMES ] : + match->name[ match->nameOffset ] : level.clients[ match->slot ].pers.netname, match->guid, &match->ip[ i ], @@ -2842,7 +2842,7 @@ qboolean G_admin_namelog( gentity_t *ent ) 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 "'%s", n->name[ i ], - ( i == n->nameOffset % MAX_NAMELOG_NAMES ) ? "*" : "" ) ); + ( i == n->nameOffset ) ? "*" : "" ) ); ADMBP( "\n" ); } ADMBP( va( "^3namelog:^7 %d recent clients found\n", printed ) ); @@ -2954,7 +2954,7 @@ qboolean G_admin_builder( gentity_t *ent ) ADMP( va( "^3builder: ^7%s built by %s^7%s\n", BG_Buildable( log->modelindex )->humanName, log->actor ? - log->actor->name[ log->actor->nameOffset % MAX_NAMELOG_NAMES ] : + log->actor->name[ log->actor->nameOffset ] : "<world>", logid ) ); break; @@ -3105,7 +3105,7 @@ qboolean G_admin_buildlog( gentity_t *ent ) fates[ log->fate ], log->actor ? " by " : "", log->actor ? - log->actor->name[ log->actor->nameOffset % MAX_NAMELOG_NAMES ] : + log->actor->name[ log->actor->nameOffset ] : "" ) ); } ADMBP( va( "^3buildlog: ^7showing %d build logs %d - %d of %d - %d. %s\n", diff --git a/src/game/g_namelog.c b/src/game/g_namelog.c index af437814..1e5b7f4f 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->nameOffset % MAX_NAMELOG_NAMES ]; + newname = n->name[ n->nameOffset ]; // 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 ], @@ -98,15 +98,15 @@ void G_namelog_update_name( gclient_t *client ) char n1[ MAX_NAME_LENGTH ], n2[ MAX_NAME_LENGTH ]; namelog_t *n = client->pers.namelog; - if( n->name[ n->nameOffset % MAX_NAMELOG_NAMES ][ 0 ] ) + if( n->name[ n->nameOffset ][ 0 ] ) { G_SanitiseString( client->pers.netname, n1, sizeof( n1 ) ); - G_SanitiseString( n->name[ n->nameOffset % MAX_NAMELOG_NAMES ], + G_SanitiseString( n->name[ n->nameOffset ], n2, sizeof( n2 ) ); if( strcmp( n1, n2 ) != 0 ) - n->nameOffset++; + n->nameOffset = ( n->nameOffset + 1 ) % MAX_NAMELOG_NAMES; } - strcpy( n->name[ n->nameOffset % MAX_NAMELOG_NAMES ], client->pers.netname ); + strcpy( n->name[ n->nameOffset ], client->pers.netname ); } void G_namelog_restore( gclient_t *client ) |