summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/cgame/cg_players.c2
-rw-r--r--src/cgame/cg_tutorial.c5
-rw-r--r--src/game/g_admin.c14
-rw-r--r--src/game/g_client.c5
-rw-r--r--src/game/g_cmds.c21
-rw-r--r--src/game/g_combat.c2
-rw-r--r--src/game/g_main.c4
-rw-r--r--src/game/g_utils.c3
-rw-r--r--src/ui/ui_main.c2
9 files changed, 26 insertions, 32 deletions
diff --git a/src/cgame/cg_players.c b/src/cgame/cg_players.c
index 1cebf451..97324fa8 100644
--- a/src/cgame/cg_players.c
+++ b/src/cgame/cg_players.c
@@ -1867,7 +1867,7 @@ void CG_Player( centity_t *cent )
int clientNum;
int renderfx;
qboolean shadow = qfalse;
- float shadowPlane;
+ float shadowPlane = 0.0f;
entityState_t *es = &cent->currentState;
class_t class = ( es->misc >> 8 ) & 0xFF;
float scale;
diff --git a/src/cgame/cg_tutorial.c b/src/cgame/cg_tutorial.c
index 2de0af9d..4f4608a0 100644
--- a/src/cgame/cg_tutorial.c
+++ b/src/cgame/cg_tutorial.c
@@ -122,9 +122,8 @@ static const char *CG_KeyNameForCommand( const char *command )
}
else
{
- Q_strncpyz( buffer, va( "\"%s\"", bindings[ i ].humanName ),
- MAX_STRING_CHARS );
- Q_strcat( buffer, MAX_STRING_CHARS, " (unbound)" );
+ Com_sprintf( buffer, MAX_STRING_CHARS, "\"%s\" (unbound)",
+ bindings[ i ].humanName );
}
return buffer;
diff --git a/src/game/g_admin.c b/src/game/g_admin.c
index 79d76f17..6ca68010 100644
--- a/src/game/g_admin.c
+++ b/src/game/g_admin.c
@@ -287,8 +287,7 @@ qboolean G_admin_name_check( gentity_t *ent, char *name, char *err, int len )
G_SanitiseName( client->pers.netname, testName );
if( !Q_stricmp( name2, testName ) )
{
- Q_strncpyz( err, va( "The name '%s^7' is already in use", name ),
- len );
+ Com_sprintf( err, len, "The name '%s^7' is already in use", name );
return qfalse;
}
}
@@ -304,8 +303,8 @@ qboolean G_admin_name_check( gentity_t *ent, char *name, char *err, int len )
if( !Q_stricmp( name2, testName ) &&
Q_stricmp( ent->client->pers.guid, g_admin_admins[ i ]->guid ) )
{
- Q_strncpyz( err, va( "The name '%s^7' belongs to an admin, "
- "please use another name", name ), len );
+ Com_sprintf( err, len, "The name '%s^7' belongs to an admin, "
+ "please use another name", name );
return qfalse;
}
}
@@ -1544,10 +1543,9 @@ static qboolean admin_create_ban( gentity_t *ent,
Q_strncpyz( b->ip, ip, sizeof( b->ip ) );
//strftime( b->made, sizeof( b->made ), "%m/%d/%y %H:%M:%S", lt );
- Q_strncpyz( b->made, va( "%02i/%02i/%02i %02i:%02i:%02i",
- (qt.tm_mon + 1), qt.tm_mday, (qt.tm_year - 100),
- qt.tm_hour, qt.tm_min, qt.tm_sec ),
- sizeof( b->made ) );
+ Com_sprintf( b->made, sizeof( b->made ), "%02i/%02i/%02i %02i:%02i:%02i",
+ qt.tm_mon + 1, qt.tm_mday, qt.tm_year % 100,
+ qt.tm_hour, qt.tm_min, qt.tm_sec );
if( ent )
Q_strncpyz( b->banner, ent->client->pers.netname, sizeof( b->banner ) );
diff --git a/src/game/g_client.c b/src/game/g_client.c
index 4d674905..a472daae 100644
--- a/src/game/g_client.c
+++ b/src/game/g_client.c
@@ -969,7 +969,6 @@ void ClientUserinfoChanged( int clientNum )
char c1[ MAX_INFO_STRING ];
char c2[ MAX_INFO_STRING ];
char userinfo[ MAX_INFO_STRING ];
- team_t team;
ent = g_entities + clientNum;
client = ent->client;
@@ -1126,8 +1125,6 @@ void ClientUserinfoChanged( int clientNum )
strcpy( c1, Info_ValueForKey( userinfo, "color1" ) );
strcpy( c2, Info_ValueForKey( userinfo, "color2" ) );
- team = client->pers.teamSelection;
-
Q_strncpyz( client->pers.voice, Info_ValueForKey( userinfo, "voice" ),
sizeof( client->pers.voice ) );
@@ -1137,7 +1134,7 @@ void ClientUserinfoChanged( int clientNum )
Com_sprintf( userinfo, sizeof( userinfo ),
"n\\%s\\t\\%i\\model\\%s\\c1\\%s\\c2\\%s\\"
"hc\\%i\\ig\\%16s\\v\\%s",
- client->pers.netname, team, model, c1, c2,
+ client->pers.netname, client->pers.teamSelection, model, c1, c2,
client->pers.maxHealth, BG_ClientListString( &client->sess.ignoreList ),
client->pers.voice );
diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c
index ea6b77f8..11952834 100644
--- a/src/game/g_cmds.c
+++ b/src/game/g_cmds.c
@@ -79,7 +79,7 @@ Returns a player number for either a number or name string
Returns -1 if invalid
==================
*/
-int G_ClientNumberFromString( gentity_t *to, char *s )
+int G_ClientNumberFromString( char *s )
{
gclient_t *cl;
int i;
@@ -1141,7 +1141,7 @@ void Cmd_CallVote_f( gentity_t *ent )
else
{
// look for an exact name match (sets clientNum to -1 if it fails)
- clientNum = G_ClientNumberFromString( ent, arg2 );
+ clientNum = G_ClientNumberFromString( arg2 );
}
if( clientNum != -1 &&
@@ -1373,7 +1373,7 @@ void Cmd_CallTeamVote_f( gentity_t *ent )
else
{
// look for an exact name match (sets clientNum to -1 if it fails)
- clientNum = G_ClientNumberFromString( ent, arg2 );
+ clientNum = G_ClientNumberFromString( arg2 );
}
// make sure this player is on the same team
@@ -2737,7 +2737,7 @@ void Cmd_Follow_f( gentity_t *ent )
}
else
{
- i = G_ClientNumberFromString( ent, arg );
+ i = G_ClientNumberFromString( arg );
if( i == -1 )
{
@@ -3300,10 +3300,8 @@ void G_PrivateMessage( gentity_t *ent )
color = teamonly ? COLOR_CYAN : COLOR_YELLOW;
- Q_strncpyz( str,
- va( "^%csent to %i player%s: ^7", color, matches,
- ( matches == 1 ) ? "" : "s" ),
- sizeof( str ) );
+ Com_sprintf( str, sizeof( str ), "^%csent to %i player%s: ^7", color, matches,
+ ( matches == 1 ) ? "" : "s" );
for( i=0; i < matches; i++ )
{
@@ -3313,11 +3311,12 @@ void G_PrivateMessage( gentity_t *ent )
Q_strcat( str, sizeof( str ), "^7, " );
Q_strcat( str, sizeof( str ), tmpent->client->pers.netname );
trap_SendServerCommand( pids[ i ], va(
- "chat \"%s^%c -> ^7%s^7: (%d recipients): ^%c%s^7\" %i",
+ "chat \"%s^%c -> ^7%s^7: (%d recipient%s): ^%c%s^7\" %i",
( ent ) ? ent->client->pers.netname : "console",
color,
name,
matches,
+ ( matches == 1 ) ? "" : "s",
color,
msg,
ent ? ent-g_entities : -1 ) );
@@ -3348,8 +3347,8 @@ void G_PrivateMessage( gentity_t *ent )
if( ignored )
{
- Q_strncpyz( str, va( "^%cignored by %i player%s: ^7", color, ignored,
- ( ignored == 1 ) ? "" : "s" ), sizeof( str ) );
+ Com_sprintf( str, sizeof( str ), "^%cignored by %i player%s: ^7", color,
+ ignored, ( ignored == 1 ) ? "" : "s" );
for( i=0; i < ignored; i++ )
{
tmpent = &g_entities[ ignoreids[ i ] ];
diff --git a/src/game/g_combat.c b/src/game/g_combat.c
index 683bb3e1..a7ba4c59 100644
--- a/src/game/g_combat.c
+++ b/src/game/g_combat.c
@@ -789,7 +789,7 @@ void G_InitDamageLocations( void )
len = trap_FS_FOpenFile( filename, &fileHandle, FS_READ );
if ( !fileHandle )
{
- G_Printf( va( S_COLOR_RED "file not found: %s\n", filename ) );
+ G_Printf( S_COLOR_RED "file not found: %s\n", filename );
continue;
}
diff --git a/src/game/g_main.c b/src/game/g_main.c
index a3123e17..bb79e173 100644
--- a/src/game/g_main.c
+++ b/src/game/g_main.c
@@ -1704,10 +1704,10 @@ void G_SendGameStat( team_t team )
entryLength = strlen( entry );
- if( dataLength + entryLength > MAX_STRING_CHARS )
+ if( dataLength + entryLength >= BIG_INFO_STRING )
break;
- Q_strncpyz( data + dataLength, entry, BIG_INFO_STRING );
+ strcpy( data + dataLength, entry );
dataLength += entryLength;
}
diff --git a/src/game/g_utils.c b/src/game/g_utils.c
index 2d2690d4..870d781b 100644
--- a/src/game/g_utils.c
+++ b/src/game/g_utils.c
@@ -802,7 +802,8 @@ gentity_t *G_ClosestEnt( vec3_t origin, gentity_t **entities, int numEntities )
{
gentity_t *ent = entities[ i ];
- if( ( nd = Distance( origin, ent->s.origin ) ) < d )
+ nd = DistanceSquared( origin, ent->s.origin );
+ if( i == 0 || nd < d )
{
d = nd;
closestEnt = ent;
diff --git a/src/ui/ui_main.c b/src/ui/ui_main.c
index 730cc498..d19d5824 100644
--- a/src/ui/ui_main.c
+++ b/src/ui/ui_main.c
@@ -4320,7 +4320,7 @@ void UI_DrawConnectScreen( qboolean overlay )
Text_PaintCenter( centerPoint, yStart + 48, scale, colorWhite, va( "Starting up..." ), ITEM_TEXTSTYLE_SHADOWEDMORE );
else
{
- strcpy( text, va( "Connecting to %s", cstate.servername ) );
+ Com_sprintf( text, sizeof( text ), "Connecting to %s", cstate.servername );
Text_PaintCenter( centerPoint, yStart + 48, scale, colorWhite, text , ITEM_TEXTSTYLE_SHADOWEDMORE );
}