Fix -Wparentheses warnings

suggest explicit braces to avoid ambiguous ‘else’
suggest parentheses around ‘&&’ within ‘||’
suggest parentheses around ‘-’ in operand of ‘&’
suggest parentheses around arithmetic in operand of ‘|’
equality comparison with extraneous parentheses

Functional change:
Proper HELLTIME check in Playerview due to missing parentheses.
This commit is contained in:
dhewg 2011-12-08 01:19:54 +01:00 committed by Daniel Gibson
parent 1851070be5
commit f4f5d9c914
6 changed files with 8 additions and 8 deletions

View file

@ -695,7 +695,7 @@ ID_INLINE bool idEntityPtr<type>::IsValid( void ) const {
template< class type >
ID_INLINE type *idEntityPtr<type>::GetEntity( void ) const {
int entityNum = spawnId & ( ( 1 << GENTITYNUM_BITS ) - 1 );
if ( ( gameLocal.spawnIds[ entityNum ] == ( spawnId >> GENTITYNUM_BITS ) ) ) {
if ( gameLocal.spawnIds[ entityNum ] == ( spawnId >> GENTITYNUM_BITS ) ) {
return static_cast<type *>( gameLocal.entities[ entityNum ] );
}
return NULL;

View file

@ -1377,7 +1377,7 @@ void FullscreenFX_DoubleVision::HighQuality() {
color.z = 0;
}
if ( !gameLocal.isMultiplayer && gameLocal.fast.time < player->inventory.powerupEndTime[ HELLTIME ] || gameLocal.fast.time < player->inventory.powerupEndTime[ INVULNERABILITY ]) {
if ( !gameLocal.isMultiplayer && (gameLocal.fast.time < player->inventory.powerupEndTime[ HELLTIME ] || gameLocal.fast.time < player->inventory.powerupEndTime[ INVULNERABILITY ])) {
color.y = 0;
color.z = 0;
}

View file

@ -876,7 +876,7 @@ void idAI::Event_CanBecomeSolid( void ) {
}
#ifdef _D3XP
if ( spawnClearMoveables && hit->IsType( idMoveable::Type ) || hit->IsType( idBarrel::Type ) || hit->IsType( idExplodingBarrel::Type ) ) {
if ( (spawnClearMoveables && hit->IsType( idMoveable::Type )) || (hit->IsType( idBarrel::Type ) || hit->IsType( idExplodingBarrel::Type) ) ) {
idVec3 push;
push = hit->GetPhysics()->GetOrigin() - GetPhysics()->GetOrigin();
push.z = 30.f;

View file

@ -628,7 +628,7 @@ ID_INLINE bool idEntityPtr<type>::IsValid( void ) const {
template< class type >
ID_INLINE type *idEntityPtr<type>::GetEntity( void ) const {
int entityNum = spawnId & ( ( 1 << GENTITYNUM_BITS ) - 1 );
if ( ( gameLocal.spawnIds[ entityNum ] == ( spawnId >> GENTITYNUM_BITS ) ) ) {
if ( gameLocal.spawnIds[ entityNum ] == ( spawnId >> GENTITYNUM_BITS ) ) {
return static_cast<type *>( gameLocal.entities[ entityNum ] );
}
return NULL;

View file

@ -515,7 +515,7 @@ int idBitMsg::ReadDeltaByteCounter( int oldValue ) const {
return oldValue;
}
newValue = ReadBits( i );
return ( oldValue & ~( ( 1 << i ) - 1 ) | newValue );
return ( (oldValue & ~( ( 1 << i ) - 1 ) ) | newValue );
}
/*
@ -531,7 +531,7 @@ int idBitMsg::ReadDeltaShortCounter( int oldValue ) const {
return oldValue;
}
newValue = ReadBits( i );
return ( oldValue & ~( ( 1 << i ) - 1 ) | newValue );
return ( (oldValue & ~( ( 1 << i ) - 1 ) ) | newValue );
}
/*
@ -547,7 +547,7 @@ int idBitMsg::ReadDeltaLongCounter( int oldValue ) const {
return oldValue;
}
newValue = ReadBits( i );
return ( oldValue & ~( ( 1 << i ) - 1 ) | newValue );
return ( ( oldValue & ~( ( 1 << i ) - 1 ) ) | newValue );
}
/*

View file

@ -333,7 +333,7 @@ void *idHeap::Allocate16( const dword bytes ) {
common->FatalError( "malloc failure for %i", bytes );
}
}
alignedPtr = (byte *) ( ( (int) ptr ) + 15 & ~15 );
alignedPtr = (byte *) ( ( ( (int) ptr ) + 15) & ~15 );
if ( alignedPtr - ptr < 4 ) {
alignedPtr += 16;
}