From 7b66e7aaa3c345e1122ff78d4e9030c8878afe41 Mon Sep 17 00:00:00 2001 From: Night Owl Date: Thu, 5 Apr 2018 00:26:34 +0500 Subject: [PATCH] Fix warnings. --- dlls/bubblemod/BMOD_CameraPoint.cpp | 4 ++-- dlls/bubblemod/BMOD_flyingcrowbar.cpp | 2 +- dlls/bubblemod/BMOD_messaging.cpp | 2 +- dlls/bubblemod/BMOD_messaging.h | 4 ++-- dlls/bubblemod/BMOD_player.cpp | 30 +++++++++++++-------------- dlls/bubblemod/BMOD_rune.h | 2 +- dlls/bubblemod/BMOD_snarkmine.cpp | 12 +++++------ dlls/bubblemod/BMOD_util.cpp | 4 ++-- dlls/multiplay_gamerules.cpp | 8 +++---- dlls/squeakgrenade.cpp | 2 +- dlls/util.h | 2 +- 11 files changed, 36 insertions(+), 36 deletions(-) diff --git a/dlls/bubblemod/BMOD_CameraPoint.cpp b/dlls/bubblemod/BMOD_CameraPoint.cpp index 84c897a2..ad9d2083 100644 --- a/dlls/bubblemod/BMOD_CameraPoint.cpp +++ b/dlls/bubblemod/BMOD_CameraPoint.cpp @@ -60,11 +60,11 @@ void CCamPoint::Think( void ) // If we have no owner, our owner is not in type mode, // our owner is not connected, our owner is invisible, // or our owner is a defuct player, remove ourselves. - if (!m_pOwner + if( !m_pOwner || !m_pOwner->m_bIsConnected || !m_pOwner->m_bTypeMode || m_pOwner->pev->effects & EF_NODRAW - || (STRING(m_pOwner->pev->netname)[0] == 0) + || ( ( STRING( m_pOwner->pev->netname ) )[0] == 0 ) ) { // UTIL_ClientPrintAll( HUD_PRINTTALK, " Camera point destroyed.\n"); UTIL_Remove( this ); diff --git a/dlls/bubblemod/BMOD_flyingcrowbar.cpp b/dlls/bubblemod/BMOD_flyingcrowbar.cpp index 6c3811bb..dd2cec2c 100644 --- a/dlls/bubblemod/BMOD_flyingcrowbar.cpp +++ b/dlls/bubblemod/BMOD_flyingcrowbar.cpp @@ -92,7 +92,7 @@ void CFlyingCrowbar::SpinTouch( CBaseEntity *pOther ) ClearMultiDamage( ); pOther->TraceAttack(pev, 90, pev->velocity.Normalize(), &tr, DMG_NEVERGIB ); - if (m_hOwner != NULL) + if( m_hOwner != 0 ) ApplyMultiDamage( pev, m_hOwner->pev ); else ApplyMultiDamage( pev, pev ); diff --git a/dlls/bubblemod/BMOD_messaging.cpp b/dlls/bubblemod/BMOD_messaging.cpp index 29d421a9..452b009e 100644 --- a/dlls/bubblemod/BMOD_messaging.cpp +++ b/dlls/bubblemod/BMOD_messaging.cpp @@ -42,7 +42,7 @@ extern cvar_t fraglimit; // Special msg values: // "SPEC" - spectator message. // -void PrintMessage( CBaseEntity *pEnt, int iChannel, Vector vecColor, Vector vecTime, char *msg) +void PrintMessage( CBaseEntity *pEnt, int iChannel, Vector vecColor, Vector vecTime, const char *msg ) { char szText[256]; hudtextparms_t hText = {0}; diff --git a/dlls/bubblemod/BMOD_messaging.h b/dlls/bubblemod/BMOD_messaging.h index e1d3a799..0c2d0121 100644 --- a/dlls/bubblemod/BMOD_messaging.h +++ b/dlls/bubblemod/BMOD_messaging.h @@ -39,6 +39,6 @@ #define BMOD_CHAN_COUNTDOWN 3 #define BMOD_CHAN_WEAPON 4 -void PrintMessage( CBaseEntity *pEnt, int iChannel, Vector vecColor, Vector vecTime, char *msg); +void PrintMessage( CBaseEntity *pEnt, int iChannel, Vector vecColor, Vector vecTime, const char *msg); -#endif \ No newline at end of file +#endif diff --git a/dlls/bubblemod/BMOD_player.cpp b/dlls/bubblemod/BMOD_player.cpp index 4b3c3752..c5e18185 100644 --- a/dlls/bubblemod/BMOD_player.cpp +++ b/dlls/bubblemod/BMOD_player.cpp @@ -65,7 +65,7 @@ void CBasePlayer::StartObserver( Vector vecPosition, Vector vecViewAngle ) m_pActiveItem->Holster( ); // ?? Let go of tanks? - if ( m_pTank != NULL ) + if( m_pTank != 0 ) { m_pTank->Use( this, this, USE_OFF, 0 ); m_pTank = NULL; @@ -190,8 +190,8 @@ void CBasePlayer::Observer_FindNextPlayer( bool bReverse ) // Don't spec observers or invisible players or defunct players if ( ((CBasePlayer*)pEnt)->IsObserver() || (pEnt->pev->effects & EF_NODRAW) - || (STRING(pEnt->pev->netname)[0] == 0) - || (!((CBasePlayer*)pEnt)->m_bIsConnected) + || ( ( STRING( pEnt->pev->netname ) )[0] == 0 ) + || (!((CBasePlayer*)pEnt)->m_bIsConnected) ) continue; @@ -272,7 +272,7 @@ void CBasePlayer::Observer_HandleButtons() m_afButtonReleased = 0; pev->impulse = 0; - if ((m_hObserverTarget != NULL) && (m_hObserverTarget->IsPlayer()) && (pev->iuser1 == OBS_CHASE_FREE)) + if ((m_hObserverTarget != 0) && (m_hObserverTarget->IsPlayer()) && (pev->iuser1 == OBS_CHASE_FREE)) { pev->origin = m_hObserverTarget->pev->origin; pev->velocity = m_hObserverTarget->pev->velocity; @@ -304,7 +304,7 @@ void CBasePlayer::Observer_SetMode( int iMode ) if ( iMode == OBS_CHASE_LOCKED ) { // If changing from Roaming, or starting observing, make sure there is a target - if ( m_hObserverTarget == NULL ) + if ( m_hObserverTarget == 0 ) Observer_FindNextPlayer( false ); if (m_hObserverTarget) @@ -589,25 +589,25 @@ void CBasePlayer::BMOD_Identify( void ) strcat(szExtra, "\nTyping! DO NOT SHOOT!"); } - CBasePlayer *pPlayer = (CBasePlayer *)pOther; + CBasePlayer *pOtherPlayer = (CBasePlayer *)pOther; if (IsObserver()) ClientPrint( pev, HUD_PRINTCENTER, UTIL_VarArgs ("-%s-\n(%s) %i / %i%s", - STRING( pPlayer->pev->netname ), - g_engfuncs.pfnInfoKeyValue( g_engfuncs.pfnGetInfoKeyBuffer( pPlayer->edict() ), "model" ), - (int)pPlayer->pev->health, - (int)pPlayer->pev->armorvalue, + STRING( pOtherPlayer->pev->netname ), + g_engfuncs.pfnInfoKeyValue( g_engfuncs.pfnGetInfoKeyBuffer( pOtherPlayer->edict() ), "model" ), + (int)pOtherPlayer->pev->health, + (int)pOtherPlayer->pev->armorvalue, szExtra ) ); else if ( g_pGameRules->PlayerRelationship( pOther, this ) == GR_TEAMMATE ) ClientPrint( pev, HUD_PRINTCENTER, UTIL_VarArgs ("-%s-\n%i / %i", - STRING( pPlayer->pev->netname ), - (int)pPlayer->pev->health, - (int)pPlayer->pev->armorvalue) + STRING( pOtherPlayer->pev->netname ), + (int)pOtherPlayer->pev->health, + (int)pOtherPlayer->pev->armorvalue) ); else ClientPrint( pev, HUD_PRINTCENTER, UTIL_VarArgs ("-%s-\n(%s)%s", - STRING( pPlayer->pev->netname ), - g_engfuncs.pfnInfoKeyValue( g_engfuncs.pfnGetInfoKeyBuffer( pPlayer->edict() ), "model" ), + STRING( pOtherPlayer->pev->netname ), + g_engfuncs.pfnInfoKeyValue( g_engfuncs.pfnGetInfoKeyBuffer( pOtherPlayer->edict() ), "model" ), szExtra ) ); diff --git a/dlls/bubblemod/BMOD_rune.h b/dlls/bubblemod/BMOD_rune.h index 4c750221..1ee5fab6 100644 --- a/dlls/bubblemod/BMOD_rune.h +++ b/dlls/bubblemod/BMOD_rune.h @@ -40,7 +40,7 @@ public: void EXPORT MaterializeRandom( void ); virtual BOOL MyTouch( CBasePlayer *pPlayer ) { EMIT_SOUND( pPlayer->edict(), CHAN_ITEM, "items/gunpickup2.wav", 1, ATTN_NORM ); return TRUE; }; BOOL IsRune( void ) { return TRUE; } - virtual char* RuneName ( void ) { return "Generic Rune"; } + virtual const char* RuneName ( void ) { return "Generic Rune"; } BOOL m_randomize; Vector m_vRuneColor; diff --git a/dlls/bubblemod/BMOD_snarkmine.cpp b/dlls/bubblemod/BMOD_snarkmine.cpp index 73a29763..1d8e4f27 100644 --- a/dlls/bubblemod/BMOD_snarkmine.cpp +++ b/dlls/bubblemod/BMOD_snarkmine.cpp @@ -50,7 +50,7 @@ enum tripmine_e { TRIPMINE_HOLSTER, TRIPMINE_DRAW, TRIPMINE_WORLD, - TRIPMINE_GROUND, + TRIPMINE_GROUND }; LINK_ENTITY_TO_CLASS( monster_tripsnark, CTripSnarkGrenade ); @@ -149,7 +149,7 @@ void CTripSnarkGrenade :: PowerupThink( void ) { TraceResult tr; - if (m_hOwner == NULL) + if( m_hOwner == 0 ) { // find an owner edict_t *oldowner = pev->owner; @@ -289,14 +289,14 @@ void CTripSnarkGrenade :: BeamBreakThink( void ) } else { - if (m_hOwner == NULL) + if( m_hOwner == 0 ) bBlowup = 1; - else if (m_posOwner != m_hOwner->pev->origin) + else if( m_posOwner != m_hOwner->pev->origin ) bBlowup = 1; - else if (m_angleOwner != m_hOwner->pev->angles) + else if( m_angleOwner != m_hOwner->pev->angles ) bBlowup = 1; } - + if (bBlowup) { // a bit of a hack, but all CGrenade code passes pev->owner along to make sure the proper player gets credit for the kill diff --git a/dlls/bubblemod/BMOD_util.cpp b/dlls/bubblemod/BMOD_util.cpp index 4d11d2f0..231b4d18 100644 --- a/dlls/bubblemod/BMOD_util.cpp +++ b/dlls/bubblemod/BMOD_util.cpp @@ -216,7 +216,7 @@ BOOL UTIL_OBB_PointTest(Vector vecSrc, Vector boxP, Vector boxE) return TRUE; } -void UTIL_SpeakAll( char *message ) +void UTIL_SpeakAll( const char *message ) { char text[256]; strcpy(text, "speak \""); @@ -491,7 +491,7 @@ void UTIL_SayTime( void ) { hour = hour > 12 ? hour - 12 : hour; hour = hour == 0 ? 12 : hour; int min = adjustedTime->tm_min; - char *ampm = "AM"; + const char *ampm = "AM"; if (adjustedTime->tm_hour > 11) ampm = "PM"; diff --git a/dlls/multiplay_gamerules.cpp b/dlls/multiplay_gamerules.cpp index 4baa1382..2456434c 100644 --- a/dlls/multiplay_gamerules.cpp +++ b/dlls/multiplay_gamerules.cpp @@ -1007,12 +1007,12 @@ void CHalfLifeMultiplay::DeathNotice( CBasePlayer *pVictim, entvars_t *pKiller, // BMOD Start - match kills. // tag kills where killer matched weapons with victim. - if( bm_matchkills.value && strcmp( killer_weapon_name, "tripmine" ) && strcmp( killer_weapon_name, "snark" ) && + if( ( bm_matchkills.value && strcmp( killer_weapon_name, "tripmine" ) && strcmp( killer_weapon_name, "snark" ) && ( pVictim->m_pActiveItem && ( (CBasePlayer *)Killer )->m_pActiveItem && !strcmp( STRING( ( (CBasePlayer *)Killer )->m_pActiveItem->pev->classname ), STRING( pVictim->m_pActiveItem->pev->classname ) ) && - ( (CBasePlayer *)Killer )->m_RuneFlags == RUNE_NONE ) + ( (CBasePlayer *)Killer )->m_RuneFlags == RUNE_NONE ) ) || // OR... ( !strcmp( killer_weapon_name, "flying_crowbar" ) && ( !pVictim->m_pActiveItem || @@ -1041,8 +1041,8 @@ void CHalfLifeMultiplay::DeathNotice( CBasePlayer *pVictim, entvars_t *pKiller, weapon_name = STRING( pVictim->m_pActiveItem->pev->classname ); // Hack to fix name change - char *rpg = "rpg_rocket"; - char *hand_grenade = "hand_grenade"; + const char *rpg = "rpg_rocket"; + const char *hand_grenade = "hand_grenade"; // strip the monster_* or weapon_* from the classname if( strncmp( weapon_name, "weapon_", 7 ) == 0 ) diff --git a/dlls/squeakgrenade.cpp b/dlls/squeakgrenade.cpp index a1d406de..66460fd9 100644 --- a/dlls/squeakgrenade.cpp +++ b/dlls/squeakgrenade.cpp @@ -230,7 +230,7 @@ void CSqueakGrenade::HuntThink( void ) m_hEnemy = BMOD_BestVisibleEnemy(); } - if( m_hEnemy!= NULL && m_hEnemy->IsPlayer() ) + if( m_hEnemy!= 0 && m_hEnemy->IsPlayer() ) { CBasePlayer* pPlayer = (CBasePlayer*)( (CBaseEntity *)m_hEnemy ); if( pPlayer->BMOD_IsTyping() ) diff --git a/dlls/util.h b/dlls/util.h index a1ddb76d..9a2f87db 100644 --- a/dlls/util.h +++ b/dlls/util.h @@ -587,7 +587,7 @@ CBasePlayer* UTIL_CastPlayer( int index ); BOOL UTIL_OBB_LineTest( Vector vecSrc, Vector vecDst, Vector boxP, Vector boxE ); BOOL UTIL_OBB_PointTest( Vector vecSrc, Vector boxP, Vector boxE ); -void UTIL_SpeakAll( char *message ); +void UTIL_SpeakAll( const char *message ); char *UTIL_CountVotes( void ); void UTIL_SpeakBadWeapon( void ); char *UTIL_CountVotes( void );