From a35e7b506867f3b70c628f9dc728560799575d4e Mon Sep 17 00:00:00 2001 From: Night Owl Date: Thu, 30 Mar 2017 02:33:29 +0500 Subject: [PATCH] Fix some warnings. --- cl_dll/aghl/aghudlocation.cpp | 4 ++-- cl_dll/aghl/agmatchreport.cpp | 2 +- cl_dll/aghl/agminidump.cpp | 4 ++-- cl_dll/aghl/agmodelcheck.h | 4 ++-- dlls/aghl/agarena.cpp | 2 +- dlls/aghl/agclient.cpp | 8 +++++--- dlls/aghl/agctf.cpp | 4 ++-- dlls/aghl/aggamemode.cpp | 4 ++-- dlls/aghl/aggamerules.cpp | 2 +- dlls/aghl/agglobal.cpp | 4 ++-- dlls/aghl/agmatch.cpp | 2 +- dlls/aghl/agsettings.cpp | 4 ++-- dlls/aghl/agvote.cpp | 6 +++--- dlls/player.cpp | 12 ++++++------ 14 files changed, 32 insertions(+), 30 deletions(-) diff --git a/cl_dll/aghl/aghudlocation.cpp b/cl_dll/aghl/aghudlocation.cpp index e9c0c1d9..4222564b 100644 --- a/cl_dll/aghl/aghudlocation.cpp +++ b/cl_dll/aghl/aghudlocation.cpp @@ -27,7 +27,7 @@ int AgHudLocation::Init(void) m_iFlags = 0; m_szMap[0] = '\0'; - for (int i = 1; i <= MAX_PLAYERS; i++) + for (int i = 1; i < MAX_PLAYERS + 1; i++) vPlayerLocations[i] = Vector(0,0,0); gHUD.AddHudElem(this); @@ -366,7 +366,7 @@ void AgHudLocation::ParseAndEditSayString(char* pszSay, int iPlayer) if ('l' == *pszSayTemp || 'L' == *pszSayTemp || 'd' == *pszSayTemp || 'D' == *pszSayTemp ) { //Location files. - pszSay = pszSay + sprintf(pszSay,Location(vPlayerLocations[iPlayer]).c_str()); + pszSay = pszSay + sprintf(pszSay, "%s", Location(vPlayerLocations[iPlayer]).c_str()); pszSayTemp++; continue; } diff --git a/cl_dll/aghl/agmatchreport.cpp b/cl_dll/aghl/agmatchreport.cpp index 23c31139..ac863312 100644 --- a/cl_dll/aghl/agmatchreport.cpp +++ b/cl_dll/aghl/agmatchreport.cpp @@ -54,7 +54,7 @@ void AgMatchReport::Save() //Print the players for that one. for (int iPlayer = 1; iPlayer <= gEngfuncs.GetMaxClients(); iPlayer++) { - if (g_PlayerExtraInfo[iPlayer].teamname && g_PlayerInfoList[iPlayer].name && 0 == stricmp(g_PlayerExtraInfo[iPlayer].teamname,g_TeamInfo[i].name)) + if( ( ( g_PlayerExtraInfo[iPlayer].teamname && g_PlayerInfoList[iPlayer].name && 0 == stricmp( g_PlayerExtraInfo[iPlayer].teamname,g_TeamInfo[i].name ) ) ) ) { fprintf(pFile,"%-20s\t%d\t%d\t%d\t%d\t%s\r\n",(const char*)g_PlayerInfoList[iPlayer].name,g_PlayerExtraInfo[iPlayer].frags,g_PlayerExtraInfo[iPlayer].deaths,g_PlayerInfoList[iPlayer].ping,g_PlayerInfoList[iPlayer].packetloss,AgGetAuthID(iPlayer).c_str()); } diff --git a/cl_dll/aghl/agminidump.cpp b/cl_dll/aghl/agminidump.cpp index 66bbcd96..c88d81b1 100644 --- a/cl_dll/aghl/agminidump.cpp +++ b/cl_dll/aghl/agminidump.cpp @@ -145,7 +145,7 @@ public: AgMiniDump g_MiniDump; //The dumper. -#endif CLIENT_DLL +#endif //CLIENT_DLL -#endif AG_USE_MINIDUMP +#endif //AG_USE_MINIDUMP //-- Martin Webrant diff --git a/cl_dll/aghl/agmodelcheck.h b/cl_dll/aghl/agmodelcheck.h index 64ef2287..33a797aa 100644 --- a/cl_dll/aghl/agmodelcheck.h +++ b/cl_dll/aghl/agmodelcheck.h @@ -7,8 +7,8 @@ #pragma once #endif // _MSC_VER > 1000 -#include "AgGlobal.h" -#include "AgModel.h" +#include "agglobal.h" +#include "agmodel.h" #ifdef AG_USE_CHEATPROTECTION diff --git a/dlls/aghl/agarena.cpp b/dlls/aghl/agarena.cpp index 3d176cb5..a3e3b595 100644 --- a/dlls/aghl/agarena.cpp +++ b/dlls/aghl/agarena.cpp @@ -43,7 +43,7 @@ void AgArena::Think() CBasePlayer* pPlayer1 = GetPlayer1(); CBasePlayer* pPlayer2 = GetPlayer2(); - if (!pPlayer1 || pPlayer1 && !pPlayer1->IsAlive() || !pPlayer2 || pPlayer2 && !pPlayer2->IsAlive()) + if( !pPlayer1 || ( pPlayer1 && !pPlayer1->IsAlive() ) || !pPlayer2 || ( pPlayer2 && !pPlayer2->IsAlive() ) ) { m_Status = PlayerDied; m_fNextCountdown = gpGlobals->time + 3.0; //Let the effect of him dying play for 3 seconds diff --git a/dlls/aghl/agclient.cpp b/dlls/aghl/agclient.cpp index 05e6bc52..0619b3ed 100644 --- a/dlls/aghl/agclient.cpp +++ b/dlls/aghl/agclient.cpp @@ -108,7 +108,7 @@ bool AgClient::HandleCommand(CBasePlayer* pPlayer) //Dont spectate if player is in game in arena. //Use sound and text flood checks, We dont want lamers to change to often. - if (pPlayer->IsIngame() && ARENA == AgGametype() || pPlayer->FloodCheck() || pPlayer->FloodSound()) + if( ( pPlayer->IsIngame() && ARENA == AgGametype() ) || pPlayer->FloodCheck() || pPlayer->FloodSound()) return true; if (2 == CMD_ARGC() && 1 == atoi(CMD_ARGV(1))) @@ -430,7 +430,7 @@ void AgClient::Say(CBasePlayer* pPlayer, say_type Type ) return; //Check if the user is flooding us with nonsens. - if ((All == Type || pPlayer->IsSpectator()) && pPlayer->FloodCheck() || pPlayer->FloodText()) + if( ( ( All == Type || pPlayer->IsSpectator() ) && pPlayer->FloodCheck() ) || pPlayer->FloodText()) return; bool bSendLocation = false; @@ -564,10 +564,12 @@ void AgClient::Say(CBasePlayer* pPlayer, say_type Type ) { //Flag info if (pPlayer && pPlayer->IsAlive() && !pPlayer->IsSpectator()) + { if (pPlayer->m_bFlagTeam1) pText = pText + sprintf(pText,CTF_TEAM1_NAME); else if (pPlayer->m_bFlagTeam2) pText = pText + sprintf(pText,CTF_TEAM2_NAME); + } pSayText++; continue; } @@ -761,7 +763,7 @@ void AgClient::Say(CBasePlayer* pPlayer, say_type Type ) void AgClient::Play(CBasePlayer* pPlayer, say_type Type, const char* pszWave) { //Check for flooding if spectator - if (pPlayer->IsSpectator() && pPlayer->FloodCheck() || !g_pGameRules->IsTeamplay() || pPlayer->FloodSound()) + if( ( pPlayer->IsSpectator() && pPlayer->FloodCheck() ) || !g_pGameRules->IsTeamplay() || pPlayer->FloodSound()) return; //Play sound to teammates. diff --git a/dlls/aghl/agctf.cpp b/dlls/aghl/agctf.cpp index 9d834a45..4fbc5cdc 100644 --- a/dlls/aghl/agctf.cpp +++ b/dlls/aghl/agctf.cpp @@ -401,8 +401,8 @@ void AgCTF::AddPointsForKill(CBasePlayer *pAttacker, CBasePlayer *pKilled) if ( pAttacker != pKilled && g_pGameRules->PlayerRelationship( pAttacker, pKilled ) == GR_TEAMMATE ) return; //Killed his team m8. - if (FStrEq(CTF_TEAM1_NAME, pKilled->m_szTeamName) && pKilled->m_bFlagTeam2 - ||FStrEq(CTF_TEAM2_NAME, pKilled->m_szTeamName) && pKilled->m_bFlagTeam1) + if( ( FStrEq(CTF_TEAM1_NAME, pKilled->m_szTeamName) && pKilled->m_bFlagTeam2 ) + || ( FStrEq(CTF_TEAM2_NAME, pKilled->m_szTeamName) && pKilled->m_bFlagTeam1 ) ) { //He killed the flag carrier. pAttacker->AddPoints(ag_ctf_carrierkillpoints.value, TRUE); diff --git a/dlls/aghl/aggamemode.cpp b/dlls/aghl/aggamemode.cpp index 526ceb4d..cc5f4266 100644 --- a/dlls/aghl/aggamemode.cpp +++ b/dlls/aghl/aggamemode.cpp @@ -108,7 +108,7 @@ bool AgGameMode::HandleCommand(CBasePlayer* pPlayer) return true; } - if (!IsAllowedGamemode(CMD_ARGV(0)),pPlayer) + if (!IsAllowedGamemode(CMD_ARGV(0))) return false; Gamemode(CMD_ARGV(0),pPlayer); @@ -118,7 +118,7 @@ bool AgGameMode::HandleCommand(CBasePlayer* pPlayer) { if (FStrEq(CMD_ARGV(0), "agnextmode")) { - if (!IsAllowedGamemode(CMD_ARGV(1)),pPlayer) + if (!IsAllowedGamemode(CMD_ARGV(1))) return false; NextGamemode(CMD_ARGV(1),pPlayer); diff --git a/dlls/aghl/aggamerules.cpp b/dlls/aghl/aggamerules.cpp index 705e597a..210410f4 100644 --- a/dlls/aghl/aggamerules.cpp +++ b/dlls/aghl/aggamerules.cpp @@ -255,7 +255,7 @@ void AgGameRules::PlayerSpawn(CBasePlayer* pPlayer) addDefault = TRUE; - while ( pWeaponEntity = UTIL_FindEntityByClassname( pWeaponEntity, "game_player_equip" )) + while( ( pWeaponEntity = UTIL_FindEntityByClassname( pWeaponEntity, "game_player_equip" ) ) ) { pWeaponEntity->Touch( pPlayer ); addDefault = FALSE; diff --git a/dlls/aghl/agglobal.cpp b/dlls/aghl/agglobal.cpp index aeeb53d9..3c77cef2 100644 --- a/dlls/aghl/agglobal.cpp +++ b/dlls/aghl/agglobal.cpp @@ -452,8 +452,8 @@ CBasePlayer* AgPlayerByName(const AgString& sNameOrPlayerNumber) CBasePlayer* pPlayerLoop = AgPlayerByIndex(i); if (pPlayerLoop) if ( 0 == stricmp(pPlayerLoop->GetName(),sNameOrPlayerNumber.c_str()) || - "#" == sNameOrPlayerNumber.substr(0,1) && - GETPLAYERUSERID(pPlayerLoop->edict()) == atoi(sNameOrPlayerNumber.substr(1).c_str()) + ( "#" == sNameOrPlayerNumber.substr(0,1) && + GETPLAYERUSERID(pPlayerLoop->edict()) == atoi(sNameOrPlayerNumber.substr(1).c_str() ) ) ) return pPlayerLoop; } diff --git a/dlls/aghl/agmatch.cpp b/dlls/aghl/agmatch.cpp index c5362f98..cea5b751 100644 --- a/dlls/aghl/agmatch.cpp +++ b/dlls/aghl/agmatch.cpp @@ -92,7 +92,7 @@ void AgMatch::Think() void AgMatch::Start(const AgString& sSpawn) { - if (m_fMatchStart > 0 || 0 == timelimit.value && 0 == fraglimit.value) + if( m_fMatchStart > 0 || ( 0 == timelimit.value && 0 == fraglimit.value ) ) return; //Count players diff --git a/dlls/aghl/agsettings.cpp b/dlls/aghl/agsettings.cpp index 9c833443..c36354c8 100644 --- a/dlls/aghl/agsettings.cpp +++ b/dlls/aghl/agsettings.cpp @@ -74,9 +74,9 @@ bool AgSettings::Think() m_fNextCheck = gpGlobals->time + 5.0; //Every 5 seconds. //Check if to display next map. - if (m_bCheckNextMap && timelimit.value || m_bCheckNextMap && fraglimit.value) + if( ( m_bCheckNextMap && timelimit.value ) || ( m_bCheckNextMap && fraglimit.value ) ) { - if (timeleft.value && 60 > timeleft.value || fraglimit.value && 2 > fragsleft.value) + if( ( timeleft.value && 60 > timeleft.value ) || ( fraglimit.value && 2 > fragsleft.value ) ) { #ifdef AG_NO_CLIENT_DLL AgSay(NULL,UTIL_VarArgs("Next map is %s\n",GetNextLevel().c_str()),NULL,30,0.03,0.05,2); diff --git a/dlls/aghl/agvote.cpp b/dlls/aghl/agvote.cpp index 8259dae9..76cbfc5d 100644 --- a/dlls/aghl/agvote.cpp +++ b/dlls/aghl/agvote.cpp @@ -250,9 +250,9 @@ bool AgVote::HandleCommand(CBasePlayer* pPlayer) FStrEq(m_sVote.c_str(),"agkick") || FStrEq(m_sVote.c_str(),"agadmin") ) { - if (FStrEq(m_sVote.c_str(),"agkick") && 1 > ag_vote_kick.value - ||FStrEq(m_sVote.c_str(),"agadmin") && 1 > ag_vote_admin.value - ||FStrEq(m_sVote.c_str(),"agallow") && 1 > ag_vote_allow.value + if( ( FStrEq(m_sVote.c_str(),"agkick") && 1 > ag_vote_kick.value ) + || ( FStrEq(m_sVote.c_str(),"agadmin") && 1 > ag_vote_admin.value ) + || ( FStrEq(m_sVote.c_str(),"agallow") && 1 > ag_vote_allow.value ) ) { AgConsole("Vote is not allowed by server admin.",pPlayer); diff --git a/dlls/player.cpp b/dlls/player.cpp index 1baf7443..56ca8a11 100644 --- a/dlls/player.cpp +++ b/dlls/player.cpp @@ -2642,7 +2642,7 @@ void CBasePlayer::PostThink() // Track button info so we can detect 'pressed' and 'released' buttons next frame //m_afButtonLast = pev->button; //Remove observe mode if using attack or use. - if( ( pev->button & IN_ATTACK ) && ( pev->effects == EF_NODRAW ) || ( pev->button & IN_USE ) && ( pev->effects == EF_NODRAW ) ) + if( ( ( pev->button & IN_ATTACK ) && ( pev->effects == EF_NODRAW ) ) || ( ( pev->button & IN_USE ) && ( pev->effects == EF_NODRAW ) ) ) { if( DEAD_NO == pev->deadflag || DEAD_RESPAWNABLE == pev->deadflag) { @@ -3248,7 +3248,7 @@ const char *CBasePlayer::TeamID( void ) return ""; //++ BulliT - if( IsSpectator() && ( LMS != AgGametype() || LMS == AgGametype() && !m_bReady ) ) + if( IsSpectator() && ( LMS != AgGametype() || ( LMS == AgGametype() && !m_bReady ) ) ) return ""; //-- Martin Webrant @@ -4357,8 +4357,8 @@ void CBasePlayer::UpdateClientData( void ) for( int i=0; i < MAX_AMMO_SLOTS; i++ ) { - if( m_pClientActiveItem && i == m_pClientActiveItem->PrimaryAmmoIndex() - || m_pClientActiveItem && i == m_pClientActiveItem->SecondaryAmmoIndex() ) + if( ( m_pClientActiveItem && i == m_pClientActiveItem->PrimaryAmmoIndex() ) + || ( m_pClientActiveItem && i == m_pClientActiveItem->SecondaryAmmoIndex() ) ) { // this is the primary or secondary ammo type for the active weapon so lets update the client with the info if needed. if( pPlayerTarget->m_rgAmmo[i] != m_rgAmmoLast[i] ) @@ -5476,8 +5476,8 @@ void CBasePlayer::UpdateFlagStatus( CBasePlayer *pPlayer ) else iFlagStatus2 = Home; - if( m_iFlagStatus1Last == Carry && ( iFlagStatus1 != Carry ) - ||m_iFlagStatus2Last == Carry && ( iFlagStatus2 != Carry ) ) + if( ( m_iFlagStatus1Last == Carry && ( iFlagStatus1 != Carry ) ) + || ( m_iFlagStatus2Last == Carry && ( iFlagStatus2 != Carry ) ) ) { //Turn off rendering since we cont carry it anymore. pev->renderfx = kRenderFxNone;