From 001b68a545797fd90505e523a1a4337e13f3b32c Mon Sep 17 00:00:00 2001 From: Theriaca Date: Tue, 22 Jan 2019 01:59:30 +0100 Subject: fix all compiler warnings from "stock" code --- src/cgame/cg_attachment.c | 2 +- src/game/g_admin.c | 14 ++++---------- src/game/g_cmds.c | 29 ++++++++++------------------- src/ui/ui_main.c | 39 --------------------------------------- 4 files changed, 15 insertions(+), 69 deletions(-) (limited to 'src') diff --git a/src/cgame/cg_attachment.c b/src/cgame/cg_attachment.c index 0d3c8ea..3224159 100644 --- a/src/cgame/cg_attachment.c +++ b/src/cgame/cg_attachment.c @@ -371,7 +371,7 @@ void CG_SetAttachmentTag( attachment_t *a, refEntity_t parent, a->parent = parent; a->model = model; - strncpy( a->tagName, tagName, MAX_STRING_CHARS ); + strncpy( a->tagName, tagName, MAX_STRING_CHARS - 1 ); a->tagValid = qtrue; } diff --git a/src/game/g_admin.c b/src/game/g_admin.c index 93c1d54..cee380e 100644 --- a/src/game/g_admin.c +++ b/src/game/g_admin.c @@ -7807,8 +7807,6 @@ qboolean G_admin_bring( gentity_t *ent, int skiparg ) qboolean G_admin_putmespec( gentity_t *ent, int skiparg ) { - int cs_offset; - if( !ent ) { ADMP( "!specme: sorry, but console isn't allowed on the spectators team\n"); @@ -7823,13 +7821,8 @@ qboolean G_admin_putmespec( gentity_t *ent, int skiparg ) if(ent->client->pers.teamSelection == PTE_NONE) return qfalse; - - if( ent->client->pers.teamSelection == PTE_ALIENS ) - cs_offset = 1; - else - cs_offset = 0; - //guard against build timer exploit + //guard against build timer exploit if( ent->client->pers.teamSelection != PTE_NONE && ent->client->sess.sessionTeam != TEAM_SPECTATOR && ( ent->client->ps.stats[ STAT_PCLASS ] == PCL_ALIEN_BUILDER0 || ent->client->ps.stats[ STAT_PCLASS ] == PCL_ALIEN_BUILDER0_UPG || @@ -9379,9 +9372,10 @@ qboolean G_admin_report( gentity_t *ent, int skiparg ) if( strstr( n2, s2 ) ) { - if( logmatch != i ) + if( logmatch != i ) logmatches++; - logmatch = i; + + logmatch = i; } } } diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c index fb59950..0429d31 100644 --- a/src/game/g_cmds.c +++ b/src/game/g_cmds.c @@ -775,16 +775,6 @@ void Cmd_Team_f( gentity_t *ent ) if( level.time - ent->client->pers.teamChangeTime < 1000 ) return; - if( ent->client->pers.teamSelection != PTE_NONE ) - { - int cs_offset; - - if( ent->client->pers.teamSelection == PTE_ALIENS ) - cs_offset = 1; - else - cs_offset = 0; - } - // Prevent invisible players from joining a team if( ent->client->sess.invisible == qtrue ) { @@ -2701,11 +2691,12 @@ void Cmd_CallTeamVote_f( gentity_t *ent ) if( G_admin_permission( &g_entities[ clientNum ], ADMF_IMMUNITY ) ) { char reasonprint[ MAX_STRING_CHARS ] = ""; + if( reason[ 0 ] != '\0' ) - Com_sprintf(reasonprint, sizeof(reasonprint), "With reason: %s", reason); + Com_sprintf(reasonprint, sizeof(reasonprint), "With reason: %s", reason); - Com_sprintf( message, sizeof( message ), "%s^7 attempted /callteamvote %s %s on immune admin %s^7 %s^7", - ent->client->pers.netname, arg1, arg2, g_entities[ clientNum ].client->pers.netname, reasonprint ); + Com_sprintf( message, sizeof( message ), "%s^7 attempted /callteamvote %s %s on immune admin %s^7 %s^7", + ent->client->pers.netname, arg1, arg2, g_entities[ clientNum ].client->pers.netname, reasonprint ); } } else @@ -5337,12 +5328,12 @@ static void Cmd_Ignore_f( gentity_t *ent ) return; } - if( g_floodMinTime.integer ) - if ( G_Flood_Limited( ent ) ) - { - trap_SendServerCommand( ent-g_entities, "print \"Your chat is flood-limited; wait before chatting again\n\"" ); - return; - } + if( g_floodMinTime.integer ) + if ( G_Flood_Limited( ent ) ) + { + trap_SendServerCommand( ent-g_entities, "print \"Your chat is flood-limited; wait before chatting again\n\"" ); + return; + } if( ent->client->pers.teamSelection == PTE_ALIENS ) diff --git a/src/ui/ui_main.c b/src/ui/ui_main.c index 357afc4..19161f0 100644 --- a/src/ui/ui_main.c +++ b/src/ui/ui_main.c @@ -86,47 +86,8 @@ static const serverFilter_t serverFilters[] = { {"OSP", "osp" }, }; -static const char *teamArenaGameTypes[] = { - "FFA", - "TOURNAMENT", - "SP", - "TEAM DM", - "CTF", - "1FCTF", - "OVERLOAD", - "HARVESTER", - "TEAMTOURNAMENT" -}; - -static int const numTeamArenaGameTypes = sizeof(teamArenaGameTypes) / sizeof(const char*); - - -static const char *teamArenaGameNames[] = { - "Free For All", - "Tournament", - "Single Player", - "Team Deathmatch", - "Capture the Flag", - "One Flag CTF", - "Overload", - "Harvester", - "Team Tournament", -}; - -static int const numTeamArenaGameNames = sizeof(teamArenaGameNames) / sizeof(const char*); - - static const int numServerFilters = sizeof(serverFilters) / sizeof(serverFilter_t); -static const char *sortKeys[] = { - "Server Name", - "Map Name", - "Open Player Spots", - "Game Type", - "Ping Time" -}; -static const int numSortKeys = sizeof(sortKeys) / sizeof(const char*); - static char* netnames[] = { "???", "UDP", -- cgit