From 3a691b21a4ae745c33d4659dcd8329f807b25fd9 Mon Sep 17 00:00:00 2001 From: Night Owl Date: Mon, 13 Jun 2016 19:29:45 +0500 Subject: [PATCH] Partially fix -Wswitch. --- dlls/agrunt.cpp | 9 ++++++--- dlls/barney.cpp | 4 +++- dlls/bullsquid.cpp | 6 +++++- dlls/controller.cpp | 11 +++++------ dlls/func_break.cpp | 17 +++++++++++++++-- dlls/hassassin.cpp | 16 +++++++++------- dlls/hgrunt.cpp | 19 +++++++++++-------- dlls/houndeye.cpp | 9 ++++----- dlls/ichthyosaur.cpp | 7 +++++-- dlls/islave.cpp | 4 +++- dlls/monsterstate.cpp | 4 ++++ dlls/scientist.cpp | 6 ++++++ dlls/squadmonster.cpp | 2 ++ dlls/turret.cpp | 2 ++ dlls/util.cpp | 12 +++++++----- 15 files changed, 87 insertions(+), 41 deletions(-) diff --git a/dlls/agrunt.cpp b/dlls/agrunt.cpp index b1022694..2b834276 100644 --- a/dlls/agrunt.cpp +++ b/dlls/agrunt.cpp @@ -1081,7 +1081,7 @@ Schedule_t *CAGrunt :: GetSchedule ( void ) { case MONSTERSTATE_COMBAT: { -// dead enemy + // dead enemy if ( HasConditions( bits_COND_ENEMY_DEAD ) ) { // call base class, all code to handle dead enemies is centralized there. @@ -1093,7 +1093,7 @@ Schedule_t *CAGrunt :: GetSchedule ( void ) return GetScheduleOfType( SCHED_WAKE_ANGRY ); } - // zap player! + // zap player! if ( HasConditions ( bits_COND_CAN_MELEE_ATTACK1 ) ) { AttackSound();// this is a total hack. Should be parto f the schedule @@ -1105,7 +1105,7 @@ Schedule_t *CAGrunt :: GetSchedule ( void ) return GetScheduleOfType( SCHED_SMALL_FLINCH ); } - // can attack + // can attack if ( HasConditions ( bits_COND_CAN_RANGE_ATTACK1 ) && OccupySlot ( bits_SLOTS_AGRUNT_HORNET ) ) { return GetScheduleOfType ( SCHED_RANGE_ATTACK1 ); @@ -1118,6 +1118,9 @@ Schedule_t *CAGrunt :: GetSchedule ( void ) return GetScheduleOfType ( SCHED_STANDOFF ); } + break; + default: + break; } return CSquadMonster :: GetSchedule(); diff --git a/dlls/barney.cpp b/dlls/barney.cpp index 095de85d..baaf6148 100644 --- a/dlls/barney.cpp +++ b/dlls/barney.cpp @@ -702,7 +702,7 @@ Schedule_t *CBarney :: GetSchedule ( void ) { case MONSTERSTATE_COMBAT: { -// dead enemy + // dead enemy if ( HasConditions( bits_COND_ENEMY_DEAD ) ) { // call base class, all code to handle dead enemies is centralized there. @@ -756,6 +756,8 @@ Schedule_t *CBarney :: GetSchedule ( void ) // try to say something about smells TrySmellTalk(); break; + default: + break; } return CTalkMonster::GetSchedule(); diff --git a/dlls/bullsquid.cpp b/dlls/bullsquid.cpp index 4a14f247..73f432f1 100644 --- a/dlls/bullsquid.cpp +++ b/dlls/bullsquid.cpp @@ -1060,7 +1060,7 @@ Schedule_t *CBullsquid :: GetSchedule( void ) } case MONSTERSTATE_COMBAT: { -// dead enemy + // dead enemy if ( HasConditions( bits_COND_ENEMY_DEAD ) ) { // call base class, all code to handle dead enemies is centralized there. @@ -1116,6 +1116,8 @@ Schedule_t *CBullsquid :: GetSchedule( void ) break; } + default: + break; } return CBaseMonster :: GetSchedule(); @@ -1266,6 +1268,8 @@ MONSTERSTATE CBullsquid :: GetIdealState ( void ) } break; } + default: + break; } m_IdealMonsterState = CBaseMonster :: GetIdealState(); diff --git a/dlls/controller.cpp b/dlls/controller.cpp index 629714d6..39f9742b 100644 --- a/dlls/controller.cpp +++ b/dlls/controller.cpp @@ -731,12 +731,6 @@ Schedule_t *CController :: GetSchedule ( void ) { switch ( m_MonsterState ) { - case MONSTERSTATE_IDLE: - break; - - case MONSTERSTATE_ALERT: - break; - case MONSTERSTATE_COMBAT: { Vector vecTmp = Intersect( Vector( 0, 0, 0 ), Vector( 100, 4, 7 ), Vector( 2, 10, -3 ), 20.0 ); @@ -752,6 +746,11 @@ Schedule_t *CController :: GetSchedule ( void ) } } break; + case MONSTERSTATE_IDLE: + case MONSTERSTATE_ALERT: + break; + default: + break; } return CSquadMonster :: GetSchedule(); diff --git a/dlls/func_break.cpp b/dlls/func_break.cpp index e6ba74f7..0a107b43 100644 --- a/dlls/func_break.cpp +++ b/dlls/func_break.cpp @@ -338,6 +338,11 @@ void CBreakable::Precache( void ) PRECACHE_SOUND ("debris/bustceiling.wav"); break; + case matNone: + case matLastMaterial: + break; + default: + break; } MaterialSoundPrecache( m_Material ); if ( m_iszGibModel ) @@ -510,11 +515,13 @@ void CBreakable::TraceAttack( entvars_t *pevAttacker, float flDamage, Vector vec case 1: EMIT_SOUND(ENT(pev), CHAN_VOICE, "buttons/spark6.wav", flVolume, ATTN_NORM); break; } } - break; + break; case matUnbreakableGlass: UTIL_Ricochet( ptr->vecEndPos, RANDOM_FLOAT(0.5,1.5) ); - break; + break; + default: + break; } } @@ -664,6 +671,12 @@ void CBreakable::Die( void ) case matCeilingTile: EMIT_SOUND_DYN(ENT(pev), CHAN_VOICE, "debris/bustceiling.wav", fvol, ATTN_NORM, 0, pitch); break; + case matNone: + case matLastMaterial: + case matUnbreakableGlass: + break; + default: + break; } diff --git a/dlls/hassassin.cpp b/dlls/hassassin.cpp index e5d84182..56ceec3c 100644 --- a/dlls/hassassin.cpp +++ b/dlls/hassassin.cpp @@ -858,7 +858,7 @@ Schedule_t *CHAssassin :: GetSchedule ( void ) case MONSTERSTATE_COMBAT: { -// dead enemy + // dead enemy if ( HasConditions( bits_COND_ENEMY_DEAD ) ) { // call base class, all code to handle dead enemies is centralized there. @@ -907,21 +907,21 @@ Schedule_t *CHAssassin :: GetSchedule ( void ) m_iFrustration++; } - // jump player! + // jump player! if ( HasConditions ( bits_COND_CAN_MELEE_ATTACK1 ) ) { // ALERT( at_console, "melee attack 1\n"); return GetScheduleOfType ( SCHED_MELEE_ATTACK1 ); } - // throw grenade + // throw grenade if ( HasConditions ( bits_COND_CAN_RANGE_ATTACK2 ) ) { // ALERT( at_console, "range attack 2\n"); return GetScheduleOfType ( SCHED_RANGE_ATTACK2 ); } - // spotted + // spotted if ( HasConditions ( bits_COND_SEE_ENEMY ) && HasConditions ( bits_COND_ENEMY_FACING_ME ) ) { // ALERT( at_console, "exposed\n"); @@ -929,7 +929,7 @@ Schedule_t *CHAssassin :: GetSchedule ( void ) return GetScheduleOfType ( SCHED_ASSASSIN_EXPOSED ); } - // can attack + // can attack if ( HasConditions ( bits_COND_CAN_RANGE_ATTACK1 ) ) { // ALERT( at_console, "range attack 1\n"); @@ -943,7 +943,7 @@ Schedule_t *CHAssassin :: GetSchedule ( void ) return GetScheduleOfType ( SCHED_COMBAT_FACE ); } - // new enemy + // new enemy if ( HasConditions ( bits_COND_NEW_ENEMY ) ) { // ALERT( at_console, "take cover\n"); @@ -954,6 +954,8 @@ Schedule_t *CHAssassin :: GetSchedule ( void ) return GetScheduleOfType ( SCHED_ALERT_STAND ); } break; + default: + break; } return CBaseMonster :: GetSchedule(); @@ -1012,4 +1014,4 @@ Schedule_t* CHAssassin :: GetScheduleOfType ( int Type ) return CBaseMonster :: GetScheduleOfType( Type ); } -#endif \ No newline at end of file +#endif diff --git a/dlls/hgrunt.cpp b/dlls/hgrunt.cpp index e0330696..b31248db 100644 --- a/dlls/hgrunt.cpp +++ b/dlls/hgrunt.cpp @@ -2035,14 +2035,14 @@ Schedule_t *CHGrunt :: GetSchedule( void ) { case MONSTERSTATE_COMBAT: { -// dead enemy + // dead enemy if ( HasConditions( bits_COND_ENEMY_DEAD ) ) { // call base class, all code to handle dead enemies is centralized there. return CBaseMonster :: GetSchedule(); } -// new enemy + // new enemy if ( HasConditions(bits_COND_NEW_ENEMY) ) { if ( InSquad() ) @@ -2089,7 +2089,7 @@ Schedule_t *CHGrunt :: GetSchedule( void ) } } } -// no ammo + // no ammo else if ( HasConditions ( bits_COND_NO_AMMO_LOADED ) ) { //!!!KELLY - this individual just realized he's out of bullet ammo. @@ -2098,7 +2098,7 @@ Schedule_t *CHGrunt :: GetSchedule( void ) return GetScheduleOfType ( SCHED_GRUNT_COVER_AND_RELOAD ); } -// damaged just a little + // damaged just a little else if ( HasConditions( bits_COND_LIGHT_DAMAGE ) ) { // if hurt: @@ -2124,19 +2124,19 @@ Schedule_t *CHGrunt :: GetSchedule( void ) return GetScheduleOfType( SCHED_SMALL_FLINCH ); } } -// can kick + // can kick else if ( HasConditions ( bits_COND_CAN_MELEE_ATTACK1 ) ) { return GetScheduleOfType ( SCHED_MELEE_ATTACK1 ); } -// can grenade launch + // can grenade launch else if ( FBitSet( pev->weapons, HGRUNT_GRENADELAUNCHER) && HasConditions ( bits_COND_CAN_RANGE_ATTACK2 ) && OccupySlot( bits_SLOTS_HGRUNT_GRENADE ) ) { // shoot a grenade if you can return GetScheduleOfType( SCHED_RANGE_ATTACK2 ); } -// can shoot + // can shoot else if ( HasConditions ( bits_COND_CAN_RANGE_ATTACK1 ) ) { if ( InSquad() ) @@ -2167,7 +2167,7 @@ Schedule_t *CHGrunt :: GetSchedule( void ) return GetScheduleOfType( SCHED_TAKE_COVER_FROM_ENEMY ); } } -// can't see enemy + // can't see enemy else if ( HasConditions( bits_COND_ENEMY_OCCLUDED ) ) { if ( HasConditions( bits_COND_CAN_RANGE_ATTACK2 ) && OccupySlot( bits_SLOTS_HGRUNT_GRENADE ) ) @@ -2212,6 +2212,9 @@ Schedule_t *CHGrunt :: GetSchedule( void ) return GetScheduleOfType ( SCHED_GRUNT_ESTABLISH_LINE_OF_FIRE ); } } + break; + default: + break; } // no special cases here, call the base class diff --git a/dlls/houndeye.cpp b/dlls/houndeye.cpp index aa99cc68..182d3df1 100644 --- a/dlls/houndeye.cpp +++ b/dlls/houndeye.cpp @@ -219,14 +219,11 @@ void CHoundeye :: SetYawSpeed ( void ) ys = 60; break; case ACT_WALK: - ys = 90; - break; case ACT_RUN: - ys = 90; - break; case ACT_TURN_LEFT: case ACT_TURN_RIGHT: - ys = 90; + break; + default: break; } @@ -1298,6 +1295,8 @@ Schedule_t *CHoundeye :: GetSchedule( void ) } break; } + default: + break; } return CSquadMonster :: GetSchedule(); diff --git a/dlls/ichthyosaur.cpp b/dlls/ichthyosaur.cpp index 281dfd00..b10227da 100644 --- a/dlls/ichthyosaur.cpp +++ b/dlls/ichthyosaur.cpp @@ -534,11 +534,11 @@ Schedule_t* CIchthyosaur::GetSchedule() case MONSTERSTATE_IDLE: m_flightSpeed = 80; return GetScheduleOfType( SCHED_IDLE_WALK ); - + break; case MONSTERSTATE_ALERT: m_flightSpeed = 150; return GetScheduleOfType( SCHED_IDLE_WALK ); - + break; case MONSTERSTATE_COMBAT: m_flMaxSpeed = 400; // eat them @@ -561,6 +561,9 @@ Schedule_t* CIchthyosaur::GetSchedule() } return GetScheduleOfType( SCHED_STANDOFF ); + break; + default: + break; } return CFlyingMonster :: GetSchedule(); diff --git a/dlls/islave.cpp b/dlls/islave.cpp index 9c3964e3..d4ad75b4 100644 --- a/dlls/islave.cpp +++ b/dlls/islave.cpp @@ -668,7 +668,7 @@ Schedule_t *CISlave :: GetSchedule( void ) switch (m_MonsterState) { case MONSTERSTATE_COMBAT: -// dead enemy + // dead enemy if ( HasConditions( bits_COND_ENEMY_DEAD ) ) { // call base class, all code to handle dead enemies is centralized there. @@ -692,6 +692,8 @@ Schedule_t *CISlave :: GetSchedule( void ) } } break; + default: + break; } return CSquadMonster::GetSchedule( ); } diff --git a/dlls/monsterstate.cpp b/dlls/monsterstate.cpp index 14518e1c..3c1620aa 100644 --- a/dlls/monsterstate.cpp +++ b/dlls/monsterstate.cpp @@ -50,6 +50,8 @@ void CBaseMonster :: SetState ( MONSTERSTATE State ) ALERT ( at_aiconsole, "Stripped\n" ); } break; + default: + break; } m_MonsterState = State; @@ -227,6 +229,8 @@ MONSTERSTATE CBaseMonster :: GetIdealState ( void ) case MONSTERSTATE_DEAD: m_IdealMonsterState = MONSTERSTATE_DEAD; break; + default: + break; } return m_IdealMonsterState; diff --git a/dlls/scientist.cpp b/dlls/scientist.cpp index b021b1d7..0b7c6eac 100644 --- a/dlls/scientist.cpp +++ b/dlls/scientist.cpp @@ -617,6 +617,8 @@ void CScientist :: SetYawSpeed ( void ) case ACT_TURN_RIGHT: ys = 120; break; + default: + break; } pev->yaw_speed = ys; @@ -996,6 +998,8 @@ Schedule_t *CScientist :: GetSchedule ( void ) return slScientistCover; // Run & Cower break; + default: + break; } return CTalkMonster::GetSchedule(); @@ -1058,6 +1062,8 @@ MONSTERSTATE CScientist :: GetIdealState ( void ) } } break; + default: + break; } return CTalkMonster::GetIdealState(); diff --git a/dlls/squadmonster.cpp b/dlls/squadmonster.cpp index 993e877c..c2d85351 100644 --- a/dlls/squadmonster.cpp +++ b/dlls/squadmonster.cpp @@ -533,6 +533,8 @@ MONSTERSTATE CSquadMonster :: GetIdealState ( void ) SquadMakeEnemy ( m_hEnemy ); } break; + default: + break; } return CBaseMonster :: GetIdealState(); diff --git a/dlls/turret.cpp b/dlls/turret.cpp index 10a0c839..f940cbb1 100644 --- a/dlls/turret.cpp +++ b/dlls/turret.cpp @@ -813,6 +813,8 @@ void CBaseTurret::SetTurretAnim(TURRET_ANIM anim) case TURRET_ANIM_DIE: pev->framerate = 1.0; break; + default: + break; } //ALERT(at_console, "Turret anim #%d\n", anim); } diff --git a/dlls/util.cpp b/dlls/util.cpp index 5f25f79f..8391d944 100644 --- a/dlls/util.cpp +++ b/dlls/util.cpp @@ -2098,19 +2098,21 @@ int CSave :: WriteFields( const char *pname, void *pBaseData, TYPEDESCRIPTION *p { case FIELD_EVARS: entityArray[j] = EntityIndex( ((entvars_t **)pOutputData)[j] ); - break; + break; case FIELD_CLASSPTR: entityArray[j] = EntityIndex( ((CBaseEntity **)pOutputData)[j] ); - break; + break; case FIELD_EDICT: entityArray[j] = EntityIndex( ((edict_t **)pOutputData)[j] ); - break; + break; case FIELD_ENTITY: entityArray[j] = EntityIndex( ((EOFFSET *)pOutputData)[j] ); - break; + break; case FIELD_EHANDLE: entityArray[j] = EntityIndex( (CBaseEntity *)(((EHANDLE *)pOutputData)[j]) ); - break; + break; + default: + break; } } WriteInt( pTest->fieldName, entityArray, pTest->fieldSize );