From c5c5762ae4b99f3ea3d933fa820e4ab9618a6a0e Mon Sep 17 00:00:00 2001 From: dhewg Date: Sun, 15 Jan 2012 13:39:23 +0100 Subject: [PATCH] Fix "unreachable code" warnings --- d3xp/BrittleFracture.cpp | 8 ++--- d3xp/Entity.cpp | 39 +++++++++++---------- d3xp/Game_network.cpp | 73 ++++++++++++++++++++-------------------- d3xp/Item.cpp | 8 ++--- d3xp/Light.cpp | 8 ++--- d3xp/Misc.cpp | 8 ++--- d3xp/Moveable.cpp | 11 +++--- d3xp/Player.cpp | 14 ++++---- d3xp/Projectile.cpp | 8 ++--- d3xp/Weapon.cpp | 8 ++--- game/BrittleFracture.cpp | 8 ++--- game/Entity.cpp | 39 +++++++++++---------- game/Game_network.cpp | 73 ++++++++++++++++++++-------------------- game/Item.cpp | 8 ++--- game/Light.cpp | 8 ++--- game/Misc.cpp | 8 ++--- game/Moveable.cpp | 11 +++--- game/Player.cpp | 10 +++--- game/Projectile.cpp | 8 ++--- game/Weapon.cpp | 8 ++--- idlib/math/Matrix.h | 5 +-- 21 files changed, 182 insertions(+), 189 deletions(-) diff --git a/d3xp/BrittleFracture.cpp b/d3xp/BrittleFracture.cpp index 75e1349..d05022a 100644 --- a/d3xp/BrittleFracture.cpp +++ b/d3xp/BrittleFracture.cpp @@ -1374,9 +1374,9 @@ bool idBrittleFracture::ClientReceiveEvent( int event, int time, const idBitMsg Shatter( point, dir, time ); return true; } - default: { - return idEntity::ClientReceiveEvent( event, time, msg ); - } + default: + break; } - return false; + + return idEntity::ClientReceiveEvent( event, time, msg ); } diff --git a/d3xp/Entity.cpp b/d3xp/Entity.cpp index 9fb6f24..88692a4 100644 --- a/d3xp/Entity.cpp +++ b/d3xp/Entity.cpp @@ -932,21 +932,20 @@ bool idEntity::DoDormantTests( void ) { return false; } return true; - } else { - // the monster area is topologically connected to a player, but if - // the monster hasn't been woken up before, do the more precise PVS check - if ( !fl.hasAwakened ) { - if ( !gameLocal.InPlayerPVS( this ) ) { - return true; // stay dormant - } - } - - // wake up - dormantStart = 0; - fl.hasAwakened = true; // only go dormant when area closed off now, not just out of PVS - return false; } + // the monster area is topologically connected to a player, but if + // the monster hasn't been woken up before, do the more precise PVS check + if ( !fl.hasAwakened ) { + if ( !gameLocal.InPlayerPVS( this ) ) { + return true; // stay dormant + } + } + + // wake up + dormantStart = 0; + fl.hasAwakened = true; // only go dormant when area closed off now, not just out of PVS + return false; } @@ -5028,10 +5027,10 @@ bool idEntity::ClientReceiveEvent( int event, int time, const idBitMsg &msg ) { StopSound( channel, false ); return true; } - default: { - return false; - } + default: + break; } + return false; } @@ -5509,11 +5508,11 @@ bool idAnimatedEntity::ClientReceiveEvent( int event, int time, const idBitMsg & AddLocalDamageEffect( jointNum, localOrigin, localNormal, localDir, damageDef, collisionMaterial ); return true; } - default: { - return idEntity::ClientReceiveEvent( event, time, msg ); - } + default: + break; } - return false; + + return idEntity::ClientReceiveEvent( event, time, msg ); } /* diff --git a/d3xp/Game_network.cpp b/d3xp/Game_network.cpp index ae53fad..d65be3d 100644 --- a/d3xp/Game_network.cpp +++ b/d3xp/Game_network.cpp @@ -1615,49 +1615,48 @@ bool idGameLocal::DownloadRequest( const char *IP, const char *guid, const char } idStr::snPrintf( urls, MAX_STRING_CHARS, "1;%s", cvarSystem->GetCVarString( "si_serverURL" ) ); return true; - } else { - // 2: table of pak URLs - // first token is the game pak if request, empty if not requested by the client - // there may be empty tokens for paks the server couldn't pinpoint - the order matters - idStr reply = "2;"; - idStrList dlTable, pakList; - int i, j; + } - Tokenize( dlTable, cvarSystem->GetCVarString( "net_serverDlTable" ) ); - Tokenize( pakList, paks ); + // 2: table of pak URLs + // first token is the game pak if request, empty if not requested by the client + // there may be empty tokens for paks the server couldn't pinpoint - the order matters + idStr reply = "2;"; + idStrList dlTable, pakList; + int i, j; - for ( i = 0; i < pakList.Num(); i++ ) { - if ( i > 0 ) { - reply += ";"; - } - if ( pakList[ i ][ 0 ] == '\0' ) { - if ( i == 0 ) { - // pak 0 will always miss when client doesn't ask for game bin - common->DPrintf( "no game pak request\n" ); - } else { - common->DPrintf( "no pak %d\n", i ); - } - continue; - } - for ( j = 0; j < dlTable.Num(); j++ ) { - if ( !fileSystem->FilenameCompare( pakList[ i ], dlTable[ j ] ) ) { - break; - } - } - if ( j == dlTable.Num() ) { - common->Printf( "download for %s: pak not matched: %s\n", IP, pakList[ i ].c_str() ); + Tokenize( dlTable, cvarSystem->GetCVarString( "net_serverDlTable" ) ); + Tokenize( pakList, paks ); + + for ( i = 0; i < pakList.Num(); i++ ) { + if ( i > 0 ) { + reply += ";"; + } + if ( pakList[ i ][ 0 ] == '\0' ) { + if ( i == 0 ) { + // pak 0 will always miss when client doesn't ask for game bin + common->DPrintf( "no game pak request\n" ); } else { - idStr url = cvarSystem->GetCVarString( "net_serverDlBaseURL" ); - url.AppendPath( dlTable[ j ] ); - reply += url; - common->DPrintf( "download for %s: %s\n", IP, url.c_str() ); + common->DPrintf( "no pak %d\n", i ); + } + continue; + } + for ( j = 0; j < dlTable.Num(); j++ ) { + if ( !fileSystem->FilenameCompare( pakList[ i ], dlTable[ j ] ) ) { + break; } } - - idStr::Copynz( urls, reply, MAX_STRING_CHARS ); - return true; + if ( j == dlTable.Num() ) { + common->Printf( "download for %s: pak not matched: %s\n", IP, pakList[ i ].c_str() ); + } else { + idStr url = cvarSystem->GetCVarString( "net_serverDlBaseURL" ); + url.AppendPath( dlTable[ j ] ); + reply += url; + common->DPrintf( "download for %s: %s\n", IP, url.c_str() ); + } } - return false; + + idStr::Copynz( urls, reply, MAX_STRING_CHARS ); + return true; } /* diff --git a/d3xp/Item.cpp b/d3xp/Item.cpp index 87d0eea..0c1356d 100644 --- a/d3xp/Item.cpp +++ b/d3xp/Item.cpp @@ -486,11 +486,11 @@ bool idItem::ClientReceiveEvent( int event, int time, const idBitMsg &msg ) { Event_RespawnFx(); return true; } - default: { - return idEntity::ClientReceiveEvent( event, time, msg ); - } + default: + break; } - return false; + + return idEntity::ClientReceiveEvent( event, time, msg ); } /* diff --git a/d3xp/Light.cpp b/d3xp/Light.cpp index 98b7995..a937c8b 100644 --- a/d3xp/Light.cpp +++ b/d3xp/Light.cpp @@ -1157,9 +1157,9 @@ bool idLight::ClientReceiveEvent( int event, int time, const idBitMsg &msg ) { BecomeBroken( NULL ); return true; } - default: { - return idEntity::ClientReceiveEvent( event, time, msg ); - } + default: + break; } - return false; + + return idEntity::ClientReceiveEvent( event, time, msg ); } diff --git a/d3xp/Misc.cpp b/d3xp/Misc.cpp index 55cf679..f87342d 100644 --- a/d3xp/Misc.cpp +++ b/d3xp/Misc.cpp @@ -137,11 +137,11 @@ bool idPlayerStart::ClientReceiveEvent( int event, int time, const idBitMsg &msg } return true; } - default: { - return idEntity::ClientReceiveEvent( event, time, msg ); - } + default: + break; } - return false; + + return idEntity::ClientReceiveEvent( event, time, msg ); } /* diff --git a/d3xp/Moveable.cpp b/d3xp/Moveable.cpp index 2ab494e..f771ece 100644 --- a/d3xp/Moveable.cpp +++ b/d3xp/Moveable.cpp @@ -1345,15 +1345,14 @@ idExplodingBarrel::ClientReceiveEvent bool idExplodingBarrel::ClientReceiveEvent( int event, int time, const idBitMsg &msg ) { switch( event ) { - case EVENT_EXPLODE: { + case EVENT_EXPLODE: if ( gameLocal.realClientTime - msg.ReadLong() < spawnArgs.GetInt( "explode_lapse", "1000" ) ) { ExplodingEffects( ); } return true; - } - default: { - return idBarrel::ClientReceiveEvent( event, time, msg ); - } + default: + break; } - return false; + + return idBarrel::ClientReceiveEvent( event, time, msg ); } diff --git a/d3xp/Player.cpp b/d3xp/Player.cpp index f53b09f..ae217f6 100644 --- a/d3xp/Player.cpp +++ b/d3xp/Player.cpp @@ -7633,11 +7633,9 @@ bool idPlayer::CanGive( const char *statname, const char *value ) { return false; } return true; - } else { - return inventory.CanGive( this, spawnArgs, statname, value, &idealWeapon ); } - return false; + return inventory.CanGive( this, spawnArgs, statname, value, &idealWeapon ); } /* @@ -9817,13 +9815,13 @@ bool idPlayer::ClientReceiveEvent( int event, int time, const idBitMsg &msg ) { // happens if the event and the spectate change are written on the server during the same frame (fraglimit) return true; } - return idActor::ClientReceiveEvent( event, time, msg ); - } - default: { - return idActor::ClientReceiveEvent( event, time, msg ); + break; } + default: + break; } - return false; + + return idActor::ClientReceiveEvent( event, time, msg ); } /* diff --git a/d3xp/Projectile.cpp b/d3xp/Projectile.cpp index 4b7bbfe..6e53ce3 100644 --- a/d3xp/Projectile.cpp +++ b/d3xp/Projectile.cpp @@ -1383,11 +1383,11 @@ bool idProjectile::ClientReceiveEvent( int event, int time, const idBitMsg &msg DefaultDamageEffect( this, spawnArgs, collision, velocity ); return true; } - default: { - return idEntity::ClientReceiveEvent( event, time, msg ); - } + default: + break; } - return false; + + return idEntity::ClientReceiveEvent( event, time, msg ); } /* diff --git a/d3xp/Weapon.cpp b/d3xp/Weapon.cpp index c820ba1..79a246f 100644 --- a/d3xp/Weapon.cpp +++ b/d3xp/Weapon.cpp @@ -2757,11 +2757,11 @@ bool idWeapon::ClientReceiveEvent( int event, int time, const idBitMsg &msg ) { } return true; } - default: { - return idEntity::ClientReceiveEvent( event, time, msg ); - } + default: + break; } - return false; + + return idEntity::ClientReceiveEvent( event, time, msg ); } /*********************************************************************** diff --git a/game/BrittleFracture.cpp b/game/BrittleFracture.cpp index c6900fd..58557a0 100644 --- a/game/BrittleFracture.cpp +++ b/game/BrittleFracture.cpp @@ -1280,9 +1280,9 @@ bool idBrittleFracture::ClientReceiveEvent( int event, int time, const idBitMsg Shatter( point, dir, time ); return true; } - default: { - return idEntity::ClientReceiveEvent( event, time, msg ); - } + default: + break; } - return false; + + return idEntity::ClientReceiveEvent( event, time, msg ); } diff --git a/game/Entity.cpp b/game/Entity.cpp index d855219..f7776dc 100644 --- a/game/Entity.cpp +++ b/game/Entity.cpp @@ -863,21 +863,20 @@ bool idEntity::DoDormantTests( void ) { return false; } return true; - } else { - // the monster area is topologically connected to a player, but if - // the monster hasn't been woken up before, do the more precise PVS check - if ( !fl.hasAwakened ) { - if ( !gameLocal.InPlayerPVS( this ) ) { - return true; // stay dormant - } - } - - // wake up - dormantStart = 0; - fl.hasAwakened = true; // only go dormant when area closed off now, not just out of PVS - return false; } + // the monster area is topologically connected to a player, but if + // the monster hasn't been woken up before, do the more precise PVS check + if ( !fl.hasAwakened ) { + if ( !gameLocal.InPlayerPVS( this ) ) { + return true; // stay dormant + } + } + + // wake up + dormantStart = 0; + fl.hasAwakened = true; // only go dormant when area closed off now, not just out of PVS + return false; } @@ -4854,10 +4853,10 @@ bool idEntity::ClientReceiveEvent( int event, int time, const idBitMsg &msg ) { StopSound( channel, false ); return true; } - default: { - return false; - } + default: + break; } + return false; } @@ -5297,11 +5296,11 @@ bool idAnimatedEntity::ClientReceiveEvent( int event, int time, const idBitMsg & AddLocalDamageEffect( jointNum, localOrigin, localNormal, localDir, damageDef, collisionMaterial ); return true; } - default: { - return idEntity::ClientReceiveEvent( event, time, msg ); - } + default: + break; } - return false; + + return idEntity::ClientReceiveEvent( event, time, msg ); } /* diff --git a/game/Game_network.cpp b/game/Game_network.cpp index aaaa96e..0a1b07a 100644 --- a/game/Game_network.cpp +++ b/game/Game_network.cpp @@ -1570,49 +1570,48 @@ bool idGameLocal::DownloadRequest( const char *IP, const char *guid, const char } idStr::snPrintf( urls, MAX_STRING_CHARS, "1;%s", cvarSystem->GetCVarString( "si_serverURL" ) ); return true; - } else { - // 2: table of pak URLs - // first token is the game pak if request, empty if not requested by the client - // there may be empty tokens for paks the server couldn't pinpoint - the order matters - idStr reply = "2;"; - idStrList dlTable, pakList; - int i, j; + } - Tokenize( dlTable, cvarSystem->GetCVarString( "net_serverDlTable" ) ); - Tokenize( pakList, paks ); + // 2: table of pak URLs + // first token is the game pak if request, empty if not requested by the client + // there may be empty tokens for paks the server couldn't pinpoint - the order matters + idStr reply = "2;"; + idStrList dlTable, pakList; + int i, j; - for ( i = 0; i < pakList.Num(); i++ ) { - if ( i > 0 ) { - reply += ";"; - } - if ( pakList[ i ][ 0 ] == '\0' ) { - if ( i == 0 ) { - // pak 0 will always miss when client doesn't ask for game bin - common->DPrintf( "no game pak request\n" ); - } else { - common->DPrintf( "no pak %d\n", i ); - } - continue; - } - for ( j = 0; j < dlTable.Num(); j++ ) { - if ( !fileSystem->FilenameCompare( pakList[ i ], dlTable[ j ] ) ) { - break; - } - } - if ( j == dlTable.Num() ) { - common->Printf( "download for %s: pak not matched: %s\n", IP, pakList[ i ].c_str() ); + Tokenize( dlTable, cvarSystem->GetCVarString( "net_serverDlTable" ) ); + Tokenize( pakList, paks ); + + for ( i = 0; i < pakList.Num(); i++ ) { + if ( i > 0 ) { + reply += ";"; + } + if ( pakList[ i ][ 0 ] == '\0' ) { + if ( i == 0 ) { + // pak 0 will always miss when client doesn't ask for game bin + common->DPrintf( "no game pak request\n" ); } else { - idStr url = cvarSystem->GetCVarString( "net_serverDlBaseURL" ); - url.AppendPath( dlTable[ j ] ); - reply += url; - common->DPrintf( "download for %s: %s\n", IP, url.c_str() ); + common->DPrintf( "no pak %d\n", i ); + } + continue; + } + for ( j = 0; j < dlTable.Num(); j++ ) { + if ( !fileSystem->FilenameCompare( pakList[ i ], dlTable[ j ] ) ) { + break; } } - - idStr::Copynz( urls, reply, MAX_STRING_CHARS ); - return true; + if ( j == dlTable.Num() ) { + common->Printf( "download for %s: pak not matched: %s\n", IP, pakList[ i ].c_str() ); + } else { + idStr url = cvarSystem->GetCVarString( "net_serverDlBaseURL" ); + url.AppendPath( dlTable[ j ] ); + reply += url; + common->DPrintf( "download for %s: %s\n", IP, url.c_str() ); + } } - return false; + + idStr::Copynz( urls, reply, MAX_STRING_CHARS ); + return true; } /* diff --git a/game/Item.cpp b/game/Item.cpp index 9ed3682..97ae952 100644 --- a/game/Item.cpp +++ b/game/Item.cpp @@ -478,11 +478,11 @@ bool idItem::ClientReceiveEvent( int event, int time, const idBitMsg &msg ) { Event_RespawnFx(); return true; } - default: { - return idEntity::ClientReceiveEvent( event, time, msg ); - } + default: + break; } - return false; + + return idEntity::ClientReceiveEvent( event, time, msg ); } /* diff --git a/game/Light.cpp b/game/Light.cpp index 558e04e..a195b35 100644 --- a/game/Light.cpp +++ b/game/Light.cpp @@ -1150,9 +1150,9 @@ bool idLight::ClientReceiveEvent( int event, int time, const idBitMsg &msg ) { BecomeBroken( NULL ); return true; } - default: { - return idEntity::ClientReceiveEvent( event, time, msg ); - } + default: + break; } - return false; + + return idEntity::ClientReceiveEvent( event, time, msg ); } diff --git a/game/Misc.cpp b/game/Misc.cpp index 9e6ec73..bfde719 100644 --- a/game/Misc.cpp +++ b/game/Misc.cpp @@ -137,11 +137,11 @@ bool idPlayerStart::ClientReceiveEvent( int event, int time, const idBitMsg &msg } return true; } - default: { - return idEntity::ClientReceiveEvent( event, time, msg ); - } + default: + break; } - return false; + + return idEntity::ClientReceiveEvent( event, time, msg ); } /* diff --git a/game/Moveable.cpp b/game/Moveable.cpp index a0517ff..13bd7be 100644 --- a/game/Moveable.cpp +++ b/game/Moveable.cpp @@ -1181,15 +1181,14 @@ idExplodingBarrel::ClientReceiveEvent bool idExplodingBarrel::ClientReceiveEvent( int event, int time, const idBitMsg &msg ) { switch( event ) { - case EVENT_EXPLODE: { + case EVENT_EXPLODE: if ( gameLocal.realClientTime - msg.ReadLong() < spawnArgs.GetInt( "explode_lapse", "1000" ) ) { ExplodingEffects( ); } return true; - } - default: { - return idBarrel::ClientReceiveEvent( event, time, msg ); - } + default: + break; } - return false; + + return idBarrel::ClientReceiveEvent( event, time, msg ); } diff --git a/game/Player.cpp b/game/Player.cpp index 0ed61a5..3535002 100644 --- a/game/Player.cpp +++ b/game/Player.cpp @@ -8263,13 +8263,13 @@ bool idPlayer::ClientReceiveEvent( int event, int time, const idBitMsg &msg ) { // happens if the event and the spectate change are written on the server during the same frame (fraglimit) return true; } - return idActor::ClientReceiveEvent( event, time, msg ); - } - default: { - return idActor::ClientReceiveEvent( event, time, msg ); + break; } + default: + break; } - return false; + + return idActor::ClientReceiveEvent( event, time, msg ); } /* diff --git a/game/Projectile.cpp b/game/Projectile.cpp index 1ac8820..a0ea4b0 100644 --- a/game/Projectile.cpp +++ b/game/Projectile.cpp @@ -1210,11 +1210,11 @@ bool idProjectile::ClientReceiveEvent( int event, int time, const idBitMsg &msg DefaultDamageEffect( this, spawnArgs, collision, velocity ); return true; } - default: { - return idEntity::ClientReceiveEvent( event, time, msg ); - } + default: + break; } - return false; + + return idEntity::ClientReceiveEvent( event, time, msg ); } /* diff --git a/game/Weapon.cpp b/game/Weapon.cpp index 45b6d6a..7020ca5 100644 --- a/game/Weapon.cpp +++ b/game/Weapon.cpp @@ -2329,11 +2329,11 @@ bool idWeapon::ClientReceiveEvent( int event, int time, const idBitMsg &msg ) { } return true; } - default: { - return idEntity::ClientReceiveEvent( event, time, msg ); - } + default: + break; } - return false; + + return idEntity::ClientReceiveEvent( event, time, msg ); } /*********************************************************************** diff --git a/idlib/math/Matrix.h b/idlib/math/Matrix.h index 9b267ea..24ed20f 100644 --- a/idlib/math/Matrix.h +++ b/idlib/math/Matrix.h @@ -2649,9 +2649,10 @@ ID_INLINE bool idMatX::InverseFastSelf( void ) { case 6: return reinterpret_cast(mat)->InverseFastSelf(); default: - return InverseSelfGeneric(); + break; } - return false; + + return InverseSelfGeneric(); } ID_INLINE idVecX idMatX::Multiply( const idVecX &vec ) const {