Fix some warnings.

This commit is contained in:
Night Owl 2018-02-12 20:22:43 +05:00
parent c7a1490337
commit b31b4e86b2
20 changed files with 48 additions and 49 deletions

View File

@ -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;
}
/*********************

View File

@ -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.

View File

@ -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 ) );
}

View File

@ -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;

View File

@ -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 );

View File

@ -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 );

View File

@ -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 ) )
{

View File

@ -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;

View File

@ -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.

View File

@ -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.

View File

@ -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
{

View File

@ -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;

View File

@ -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)) )
{

View File

@ -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();

View File

@ -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 )

View File

@ -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( );

View File

@ -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 );

View File

@ -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");

View File

@ -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)
{

View File

@ -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
#endif // UTIL_H