ValveSoftware / source-sdk-2013

The 2013 edition of the Source SDK
https://developer.valvesoftware.com/wiki/SDK2013_GettingStarted
Other
3.73k stars 1.99k forks source link

PVS-Studio: V523 The 'then' statement is equivalent to the 'else' statement. #417

Open SviatoslavRazmyslov opened 7 years ago

SviatoslavRazmyslov commented 7 years ago

We have found bugs using PVS-Studio tool. PVS-Studio is a static code analyzer for C, C++ and C#: https://www.viva64.com/en/pvs-studio/

void CTriggerWateryDeath::StartTouch(CBaseEntity *pOther)
{
  ....
  // Always added to the end
  // Players get warned, everything else gets et quick.
  if ( pOther->IsPlayer() )
  {
    m_flEntityKillTimes.AddToTail( gpGlobals->curtime + WD_KILLTIME_NEXT_BITE );
  }
  else
  {
    m_flEntityKillTimes.AddToTail( gpGlobals->curtime + WD_KILLTIME_NEXT_BITE );
  }
  ....
}

Analyzer warning:

We suggests having a look at the emails, sent from @pvs-studio.com.