From b31b4e86b219198fab9bc48114571b96e78f89bd Mon Sep 17 00:00:00 2001 From: Night Owl Date: Mon, 12 Feb 2018 20:22:43 +0500 Subject: [PATCH] Fix some warnings. --- dlls/alias.cpp | 4 ++-- dlls/barney.cpp | 1 - dlls/bigmomma.cpp | 2 +- dlls/bullsquid.cpp | 2 +- dlls/cbase.h | 2 +- dlls/combat.cpp | 2 +- dlls/controller.cpp | 8 ++++---- dlls/effects.cpp | 4 ++-- dlls/func_tank.cpp | 2 +- dlls/hassassin.cpp | 6 +++--- dlls/hgrunt.cpp | 8 ++++---- dlls/islave_deamon.cpp | 12 ++++++------ dlls/locus.cpp | 2 +- dlls/monsters.cpp | 2 +- dlls/player.cpp | 2 +- dlls/scripted.cpp | 20 ++++++++++---------- dlls/squeakgrenade.cpp | 2 +- dlls/triggers.cpp | 8 ++++---- dlls/util.cpp | 4 ++-- dlls/util.h | 4 ++-- 20 files changed, 48 insertions(+), 49 deletions(-) diff --git a/dlls/alias.cpp b/dlls/alias.cpp index cf2b8e42..bda9f8d0 100644 --- a/dlls/alias.cpp +++ b/dlls/alias.cpp @@ -160,7 +160,7 @@ int CInfoGroup::GetMember( const char* szMemberName ) if (!szMemberName) { ALERT(at_console,"info_group: GetMember called with null szMemberName!?\n"); - return NULL; + return 0; } for (int i = 0; i < m_cMembers; i++) { @@ -183,7 +183,7 @@ int CInfoGroup::GetMember( const char* szMemberName ) ALERT(at_console,"info_group \"%s\" has no member called \"%s\".\n",STRING(pev->targetname),szMemberName); // ALERT(at_console,"getMember: fail\n"); - return NULL; + return 0; } /********************* diff --git a/dlls/barney.cpp b/dlls/barney.cpp index a6f3e6c5..eba8545b 100644 --- a/dlls/barney.cpp +++ b/dlls/barney.cpp @@ -713,7 +713,6 @@ Schedule_t *CBarney::GetScheduleOfType( int Type ) switch( Type ) { case SCHED_ARM_WEAPON: - if ( m_hEnemy != NULL ) if( m_hEnemy != 0 ) { // face enemy, then draw. diff --git a/dlls/bigmomma.cpp b/dlls/bigmomma.cpp index 05e55515..c7cccbcf 100644 --- a/dlls/bigmomma.cpp +++ b/dlls/bigmomma.cpp @@ -626,7 +626,7 @@ void CBigMomma::LaunchMortar( void ) if (m_pCine) // is a scripted_action making me shoot? { - if (m_hTargetEnt != NULL) // don't check m_fTurnType- bigmomma can fire in any direction. + if (m_hTargetEnt != 0) // don't check m_fTurnType- bigmomma can fire in any direction. { vecLaunch = VecCheckSplatToss( pev, startPos, m_hTargetEnt->pev->origin, RANDOM_FLOAT( 150, 500 ) ); } diff --git a/dlls/bullsquid.cpp b/dlls/bullsquid.cpp index db403e5f..86c6168e 100644 --- a/dlls/bullsquid.cpp +++ b/dlls/bullsquid.cpp @@ -550,7 +550,7 @@ void CBullsquid::HandleAnimEvent( MonsterEvent_t *pEvent ) vecSpitOffset = ( pev->origin + vecSpitOffset ); if (m_pCine) // LRC- are we being told to do this by a scripted_action? { - if (m_hTargetEnt != NULL && m_pCine->PreciseAttack()) + if (m_hTargetEnt != 0 && m_pCine->PreciseAttack()) vecSpitDir = ( ( m_hTargetEnt->pev->origin ) - vecSpitOffset ).Normalize(); else vecSpitDir = gpGlobals->v_forward; diff --git a/dlls/cbase.h b/dlls/cbase.h index 4e856cf5..4985ce03 100644 --- a/dlls/cbase.h +++ b/dlls/cbase.h @@ -100,7 +100,7 @@ typedef enum USE_NOT = 6, } USE_TYPE; -extern char* GetStringForUseType( USE_TYPE useType ); +extern const char *GetStringForUseType( USE_TYPE useType ); extern void FireTargets( const char *targetName, CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value ); diff --git a/dlls/combat.cpp b/dlls/combat.cpp index ee1c374d..887811df 100644 --- a/dlls/combat.cpp +++ b/dlls/combat.cpp @@ -977,7 +977,7 @@ int CBaseMonster::TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, f else if (m_iPlayerReact == 3) { // try to decide whether it was deliberate... if I have an enemy, assume it was just crossfire. - if ( m_hEnemy == NULL ) + if ( m_hEnemy == 0 ) { if ( (m_afMemory & bits_MEMORY_SUSPICIOUS) || UTIL_IsFacing( pevAttacker, pev->origin ) ) Remember( bits_MEMORY_PROVOKED ); diff --git a/dlls/controller.cpp b/dlls/controller.cpp index 09d3e1f4..4fed2a3d 100644 --- a/dlls/controller.cpp +++ b/dlls/controller.cpp @@ -647,11 +647,11 @@ void CController::RunTask( Task_t *pTask ) Vector vecSrc = vecHand + pev->velocity * ( m_flShootTime - gpGlobals->time ); Vector vecDir; - if (m_pCine != NULL || m_hEnemy != NULL) + if (m_pCine != 0 || m_hEnemy != 0 ) { - if (m_pCine != NULL) // LRC- is this a script that's telling it to fire? + if (m_pCine != 0) // LRC- is this a script that's telling it to fire? { - if (m_hTargetEnt != NULL && m_pCine->PreciseAttack()) + if (m_hTargetEnt != 0 && m_pCine->PreciseAttack()) { vecDir = (m_hTargetEnt->pev->origin - pev->origin).Normalize() * gSkillData.controllerSpeedBall; } @@ -661,7 +661,7 @@ void CController::RunTask( Task_t *pTask ) vecDir = gpGlobals->v_forward * gSkillData.controllerSpeedBall; } } - else if (m_hEnemy != NULL) + else if (m_hEnemy != 0) { if( HasConditions( bits_COND_SEE_ENEMY ) ) { diff --git a/dlls/effects.cpp b/dlls/effects.cpp index 385252d4..321d8de1 100644 --- a/dlls/effects.cpp +++ b/dlls/effects.cpp @@ -3966,7 +3966,7 @@ void CEnvELight::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE us if (pev->target) { m_hAttach = UTIL_FindEntityByTargetname( NULL, STRING(pev->target), pActivator); - if (m_hAttach == NULL) + if (m_hAttach == 0) { ALERT(at_console, "env_elight \"%s\" can't find target %s\n", STRING(pev->targetname), STRING(pev->target)); return; // error? @@ -3982,7 +3982,7 @@ void CEnvELight::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE us void CEnvELight::MakeLight(int iTime) { - if (m_hAttach == NULL) + if (m_hAttach == 0) { DontThink(); pev->takedamage = 0; diff --git a/dlls/func_tank.cpp b/dlls/func_tank.cpp index 1525932e..1c2175b1 100644 --- a/dlls/func_tank.cpp +++ b/dlls/func_tank.cpp @@ -1577,7 +1577,7 @@ void CFuncTankControls::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_ return; // if I've already got a controller, or the player's already using // another controls, then forget it. - if (m_active != FALSE || ((CBasePlayer*)pActivator)->m_pTank != NULL) + if (m_active != FALSE || ((CBasePlayer*)pActivator)->m_pTank != 0) return; //LRC- Now uses FindEntityByTargetname, so that aliases work. diff --git a/dlls/hassassin.cpp b/dlls/hassassin.cpp index cad0620a..71ff2469 100644 --- a/dlls/hassassin.cpp +++ b/dlls/hassassin.cpp @@ -186,7 +186,7 @@ void CHAssassin::SetYawSpeed( void ) //========================================================= void CHAssassin::Shoot( void ) { - if (m_hEnemy == NULL && !m_pCine) //LRC + if (m_hEnemy == 0 && !m_pCine) //LRC { return; } @@ -251,7 +251,7 @@ void CHAssassin::HandleAnimEvent( MonsterEvent_t *pEvent ) if (m_pCine && m_pCine->IsAction()) { Vector vecToss; - if (m_pCine->PreciseAttack() && m_hTargetEnt != NULL) + if (m_pCine->PreciseAttack() && m_hTargetEnt != 0) { vecToss = VecCheckToss( pev, vecGunPosition, m_hTargetEnt->pev->origin, 0.5 ); //if (vecToss != g_vecZero) @@ -282,7 +282,7 @@ void CHAssassin::HandleAnimEvent( MonsterEvent_t *pEvent ) if (m_pCine) //LRC... { pev->velocity = g_vecZero; - if (m_pCine->PreciseAttack() && m_hTargetEnt != NULL) + if (m_pCine->PreciseAttack() && m_hTargetEnt != 0) { Vector vecTemp = m_hTargetEnt->pev->origin; vecTemp.y = vecTemp.y + 50; // put her feet on the target. diff --git a/dlls/hgrunt.cpp b/dlls/hgrunt.cpp index 0d106c3c..bc001bcb 100644 --- a/dlls/hgrunt.cpp +++ b/dlls/hgrunt.cpp @@ -789,7 +789,7 @@ Vector CHGrunt::GetGunPosition() //========================================================= void CHGrunt::Shoot( void ) { - if (m_hEnemy == NULL && m_pCine == NULL) //LRC - scripts may fire when you have no enemy + if (m_hEnemy == 0 && m_pCine == 0) //LRC - scripts may fire when you have no enemy { return; } @@ -819,7 +819,7 @@ void CHGrunt::Shoot( void ) //========================================================= void CHGrunt::Shotgun( void ) { - if (m_hEnemy == NULL && m_pCine == NULL) + if (m_hEnemy == 0 && m_pCine == 0) { return; } @@ -893,7 +893,7 @@ void CHGrunt::HandleAnimEvent( MonsterEvent_t *pEvent ) if (m_pCine) { Vector vecToss = g_vecZero; - if (m_hTargetEnt != NULL && m_pCine->PreciseAttack()) + if (m_hTargetEnt != 0 && m_pCine->PreciseAttack()) { vecToss = VecCheckToss( pev, GetGunPosition(), m_hTargetEnt->pev->origin, 0.5 ); } @@ -918,7 +918,7 @@ void CHGrunt::HandleAnimEvent( MonsterEvent_t *pEvent ) if (m_pCine) { Vector vecToss; - if (m_hTargetEnt != NULL && m_pCine->PreciseAttack()) + if (m_hTargetEnt != 0 && m_pCine->PreciseAttack()) vecToss = VecCheckThrow( pev, GetGunPosition(), m_hTargetEnt->pev->origin, gSkillData.hgruntGrenadeSpeed, 0.5 ); else { diff --git a/dlls/islave_deamon.cpp b/dlls/islave_deamon.cpp index 23d92d92..442efb77 100644 --- a/dlls/islave_deamon.cpp +++ b/dlls/islave_deamon.cpp @@ -51,7 +51,7 @@ public: void HandleAnimEvent( MonsterEvent_t *pEvent ); BOOL CheckRangeAttack1 ( float flDot, float flDist ); BOOL CheckRangeAttack2 ( float flDot, float flDist ); - void CallForHelp( char *szClassname, float flDist, EHANDLE hEnemy, Vector &vecLocation ); + void CallForHelp( const char *szClassname, float flDist, EHANDLE hEnemy, Vector &vecLocation ); void TraceAttack( entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType); int TakeDamage( entvars_t* pevInflictor, entvars_t* pevAttacker, float flDamage, int bitsDamageType); @@ -160,7 +160,7 @@ int CISlave::IRelationship( CBaseEntity *pTarget ) } -void CISlave :: CallForHelp( char *szClassname, float flDist, EHANDLE hEnemy, Vector &vecLocation ) +void CISlave :: CallForHelp( const char *szClassname, float flDist, EHANDLE hEnemy, Vector &vecLocation ) { // ALERT( at_aiconsole, "help " ); @@ -191,7 +191,7 @@ void CISlave :: CallForHelp( char *szClassname, float flDist, EHANDLE hEnemy, Ve //========================================================= void CISlave :: AlertSound( void ) { - if ( m_hEnemy != NULL ) + if ( m_hEnemy != 0 ) { SENTENCEG_PlayRndSz(ENT(pev), "SLV_ALERT", 0.85, ATTN_NORM, 0, m_voicePitch); @@ -378,7 +378,7 @@ void CISlave :: HandleAnimEvent( MonsterEvent_t *pEvent ) MESSAGE_END( ); } - if (m_hDead != NULL) + if (m_hDead != 0) { WackBeam( -1, m_hDead ); WackBeam( 1, m_hDead ); @@ -399,7 +399,7 @@ void CISlave :: HandleAnimEvent( MonsterEvent_t *pEvent ) { ClearBeams( ); - if (m_hDead != NULL) + if (m_hDead != 0) { Vector vecDest = m_hDead->pev->origin + Vector( 0, 0, 38 ); TraceResult trace; @@ -501,7 +501,7 @@ BOOL CISlave :: CheckRangeAttack2 ( float flDot, float flDist ) } } } - if (m_hDead != NULL) + if (m_hDead != 0) return TRUE; else return FALSE; diff --git a/dlls/locus.cpp b/dlls/locus.cpp index 7186b602..2e90620b 100644 --- a/dlls/locus.cpp +++ b/dlls/locus.cpp @@ -117,7 +117,7 @@ void CLocusAlias::FlushChanges( void ) CBaseEntity *CLocusAlias::FollowAlias( CBaseEntity *pFrom ) { - if (m_hValue == NULL) + if (m_hValue == 0) return NULL; else if ( pFrom == NULL || (OFFSET(m_hValue->pev) > OFFSET(pFrom->pev)) ) { diff --git a/dlls/monsters.cpp b/dlls/monsters.cpp index d6f82463..f7d14728 100644 --- a/dlls/monsters.cpp +++ b/dlls/monsters.cpp @@ -3180,7 +3180,7 @@ BOOL CBaseMonster::FindLateralCover( const Vector &vecThreat, const Vector &vecV Vector CBaseMonster::ShootAtEnemy( const Vector &shootOrigin ) { - if (m_pCine != NULL && m_hTargetEnt != NULL && (m_pCine->m_fTurnType == 1)) + if (m_pCine != 0 && m_hTargetEnt != 0 && (m_pCine->m_fTurnType == 1)) { Vector vecDest = ( m_hTargetEnt->pev->absmin + m_hTargetEnt->pev->absmax ) / 2; return ( vecDest - shootOrigin ).Normalize(); diff --git a/dlls/player.cpp b/dlls/player.cpp index 79977a77..b4a8e283 100644 --- a/dlls/player.cpp +++ b/dlls/player.cpp @@ -5133,7 +5133,7 @@ class CPlayerFreeze:public CBaseDelay { void Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value ); void Think( void ); - STATE GetState( void ) { return m_hActivator == NULL? STATE_OFF: STATE_ON; } + STATE GetState( void ) { return m_hActivator == 0 ? STATE_OFF : STATE_ON; } }; void CPlayerFreeze::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value ) diff --git a/dlls/scripted.cpp b/dlls/scripted.cpp index 4d1a2995..fd01c945 100644 --- a/dlls/scripted.cpp +++ b/dlls/scripted.cpp @@ -369,29 +369,29 @@ void CCineMonster::PossessEntity( void ) { // anything with that name? pTarget->m_hTargetEnt = UTIL_FindEntityByTargetname(NULL, STRING(m_iszAttack), m_hActivator); - if ( pTarget->m_hTargetEnt == NULL ) + if( pTarget->m_hTargetEnt == 0 ) { // nothing. Anything with that classname? while ((pTarget->m_hTargetEnt = UTIL_FindEntityInSphere( pTarget->m_hTargetEnt, pev->origin, m_flRadius )) != NULL) - { + { if (FClassnameIs( pTarget->m_hTargetEnt->pev, STRING(m_iszAttack))) break; + } } - } - if (pTarget->m_hTargetEnt == NULL) + if (pTarget->m_hTargetEnt == 0) { // nothing. Oh well. ALERT(at_console,"%s %s has a missing \"turn target\": %s\n",STRING(pev->classname),STRING(pev->targetname),STRING(m_iszAttack)); pTarget->m_hTargetEnt = this; - } -} + } + } else -{ + { pTarget->m_hTargetEnt = this; } if (m_iszMoveTarget) - { + { // anything with that name? pTarget->m_pGoalEnt = UTIL_FindEntityByTargetname(NULL, STRING(m_iszMoveTarget), m_hActivator); - if (pTarget->m_pGoalEnt == NULL) + if( pTarget->m_pGoalEnt == 0 ) { // nothing. Oh well. ALERT(at_console,"%s %s has a missing \"move target\": %s\n",STRING(pev->classname),STRING(pev->targetname),STRING(m_iszMoveTarget)); pTarget->m_pGoalEnt = this; @@ -445,7 +445,7 @@ void CCineMonster::PossessEntity( void ) // at the beginning of the level, set up the idle animation. --LRC void CCineMonster :: InitIdleThink( void ) - { +{ if ((m_hTargetEnt = FindEntity(STRING(m_iszEntity), NULL)) != NULL) { PossessEntity( ); diff --git a/dlls/squeakgrenade.cpp b/dlls/squeakgrenade.cpp index e7b94994..5ad051d4 100644 --- a/dlls/squeakgrenade.cpp +++ b/dlls/squeakgrenade.cpp @@ -189,7 +189,7 @@ void CSqueakGrenade::Killed( entvars_t *pevAttacker, int iGib ) RadiusDamage( pev, pev, pev->dmg, CLASS_NONE, DMG_BLAST ); // reset owner so death message happens - if (m_hOwner != NULL) + if (m_hOwner != 0) pev->owner = m_hOwner->edict(); CBaseMonster::Killed( pevAttacker, GIB_ALWAYS ); diff --git a/dlls/triggers.cpp b/dlls/triggers.cpp index a715470a..607b7af1 100644 --- a/dlls/triggers.cpp +++ b/dlls/triggers.cpp @@ -1580,7 +1580,7 @@ public: void Use ( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value ); void Affect (CBaseEntity *pTarget, USE_TYPE useType); - int GetActionFor( int iField, int iActive, USE_TYPE useType, char *szDebug ); + int GetActionFor( int iField, int iActive, USE_TYPE useType, const char *szDebug ); void SetBoneController (float fController, int cnum, CBaseEntity *pTarget); virtual int ObjectCaps( void ) { return CBaseEntity :: ObjectCaps() & ~FCAP_ACROSS_TRANSITION; } @@ -2054,7 +2054,7 @@ void CEnvCustomize :: Affect (CBaseEntity *pTarget, USE_TYPE useType) ALERT(at_console, " ]\n"); } -int CEnvCustomize::GetActionFor( int iField, int iActive, USE_TYPE useType, char* szDebug) +int CEnvCustomize::GetActionFor( int iField, int iActive, USE_TYPE useType, const char* szDebug) { int iAction = iField; @@ -3529,7 +3529,7 @@ int CChangeLevel::ChangeList( LEVELLIST *pLevelList, int maxList ) CBaseEntity *pChangelevel = UTIL_FindEntityByClassname( NULL, "trigger_changelevel" ); if ( !pChangelevel ) - return NULL; + return 0; while ( pChangelevel ) { @@ -4595,7 +4595,7 @@ IMPLEMENT_SAVERESTORE(CMotionThread,CPointEntity); void CMotionThread::Think( void ) { - if (m_hLocus == NULL || m_hTarget == NULL) + if( m_hLocus == 0 || m_hTarget == 0 ) { if (pev->spawnflags & SF_MOTION_DEBUG) ALERT(at_console, "motion_thread expires\n"); diff --git a/dlls/util.cpp b/dlls/util.cpp index 287ee0e5..3d45d173 100644 --- a/dlls/util.cpp +++ b/dlls/util.cpp @@ -1984,7 +1984,7 @@ void UTIL_StripToken( const char *pKey, char *pDest ) } -char* GetStringForUseType( USE_TYPE useType ) +const char* GetStringForUseType( USE_TYPE useType ) { switch(useType) { @@ -1998,7 +1998,7 @@ char* GetStringForUseType( USE_TYPE useType ) } } -char* GetStringForState( STATE state ) +const char *GetStringForState( STATE state ) { switch(state) { diff --git a/dlls/util.h b/dlls/util.h index 4032798d..fdcf2417 100644 --- a/dlls/util.h +++ b/dlls/util.h @@ -209,7 +209,7 @@ typedef enum // In_Use isn't very useful, I'll probably remove it. } STATE; -extern char* GetStringForState( STATE state ); +extern const char *GetStringForState( STATE state ); // Things that toggle (buttons/triggers/doors) need this typedef enum @@ -614,4 +614,4 @@ int GetStdLightStyle (int iStyle); //LRC- declared here so it can be used by eve // needs to deal with the standard lightstyles. // LRC- for aliases and groups CBaseEntity* UTIL_FollowReference( CBaseEntity* pStartEntity, const char* szName ); -#endif // UTIL_H \ No newline at end of file +#endif // UTIL_H