war on -Werror, part 11: const int -> float loss.

Had to work around the inline static const int rule
to do it, but at least there is no data loss now.
This commit is contained in:
Jason Felds
2012-12-27 11:13:41 -05:00
parent e86aeb66a8
commit bddbed7e7e
4 changed files with 8 additions and 8 deletions
+3 -3
View File
@@ -8,7 +8,7 @@ class PlayerState;
/** @brief An action made against a Player to make things more difficult. */ /** @brief An action made against a Player to make things more difficult. */
struct Attack struct Attack
{ {
static const int ATTACK_STARTS_NOW = -10000; static const inline float ATTACK_STARTS_NOW() { return -10000.f; }
AttackLevel level; AttackLevel level;
/** /**
@@ -27,14 +27,14 @@ struct Attack
void MakeBlank() void MakeBlank()
{ {
level = ATTACK_LEVEL_1; level = ATTACK_LEVEL_1;
fStartSecond = ATTACK_STARTS_NOW; fStartSecond = ATTACK_STARTS_NOW();
fSecsRemaining = 0; fSecsRemaining = 0;
sModifiers = RString(); sModifiers = RString();
bOn = false; bOn = false;
bGlobal = false; bGlobal = false;
bShowInAttackList = true; bShowInAttackList = true;
} }
Attack(): level(ATTACK_LEVEL_1), fStartSecond(ATTACK_STARTS_NOW), Attack(): level(ATTACK_LEVEL_1), fStartSecond(ATTACK_STARTS_NOW()),
fSecsRemaining(0), sModifiers(RString()), fSecsRemaining(0), sModifiers(RString()),
bOn(false), bGlobal(false), bShowInAttackList(true) bOn(false), bGlobal(false), bShowInAttackList(true)
{} // MakeBlank() is effectively called here. {} // MakeBlank() is effectively called here.
+1 -1
View File
@@ -2858,7 +2858,7 @@ void Player::UpdateJudgedRows()
Attack attMineAttack; Attack attMineAttack;
attMineAttack.sModifiers = ApplyRandomAttack(); attMineAttack.sModifiers = ApplyRandomAttack();
attMineAttack.fStartSecond = attMineAttack.ATTACK_STARTS_NOW; attMineAttack.fStartSecond = attMineAttack.ATTACK_STARTS_NOW();
attMineAttack.fSecsRemaining = fAttackRunTime; attMineAttack.fSecsRemaining = fAttackRunTime;
m_pPlayerState->LaunchAttack( attMineAttack ); m_pPlayerState->LaunchAttack( attMineAttack );
+2 -2
View File
@@ -66,7 +66,7 @@ void PlayerState::Update( float fDelta )
// You must add sattack by calling GameState::LaunchAttack, // You must add sattack by calling GameState::LaunchAttack,
// or else the sentinel value won't be // or else the sentinel value won't be
// converted into the current music time. // converted into the current music time.
ASSERT( attack.fStartSecond != attack.ATTACK_STARTS_NOW ); ASSERT( attack.fStartSecond != attack.ATTACK_STARTS_NOW() );
bool bCurrentlyEnabled = bool bCurrentlyEnabled =
attack.bGlobal || attack.bGlobal ||
@@ -116,7 +116,7 @@ void PlayerState::LaunchAttack( const Attack& a )
* started so it can be removed later. For m_ModsToApply, leave the sentinel in, * started so it can be removed later. For m_ModsToApply, leave the sentinel in,
* so Player::Update knows to apply attack transforms correctly. (yuck) */ * so Player::Update knows to apply attack transforms correctly. (yuck) */
m_ModsToApply.push_back( attack ); m_ModsToApply.push_back( attack );
if( attack.fStartSecond == attack.ATTACK_STARTS_NOW ) if( attack.fStartSecond == attack.ATTACK_STARTS_NOW() )
attack.fStartSecond = m_Position.m_fMusicSeconds; attack.fStartSecond = m_Position.m_fMusicSeconds;
m_ActiveAttacks.push_back( attack ); m_ActiveAttacks.push_back( attack );
+2 -2
View File
@@ -979,7 +979,7 @@ void ScreenGameplay::SetupSong( int iSongIndex )
Attack a = pi->m_asModifiersQueue[iSongIndex][i]; Attack a = pi->m_asModifiersQueue[iSongIndex][i];
if( a.fStartSecond != 0 ) if( a.fStartSecond != 0 )
continue; continue;
a.fStartSecond = a.ATTACK_STARTS_NOW; // now a.fStartSecond = a.ATTACK_STARTS_NOW(); // now
PlayerOptions po; PlayerOptions po;
po.FromString( a.sModifiers ); po.FromString( a.sModifiers );
@@ -1029,7 +1029,7 @@ void ScreenGameplay::SetupSong( int iSongIndex )
{ {
Attack a = pi->m_asModifiersQueue[iSongIndex][i]; Attack a = pi->m_asModifiersQueue[iSongIndex][i];
if( a.fStartSecond == 0 ) if( a.fStartSecond == 0 )
a.fStartSecond = a.ATTACK_STARTS_NOW; // now a.fStartSecond = a.ATTACK_STARTS_NOW(); // now
pi->GetPlayerState()->LaunchAttack( a ); pi->GetPlayerState()->LaunchAttack( a );
GAMESTATE->m_SongOptions.FromString( ModsLevel_Song, a.sModifiers ); GAMESTATE->m_SongOptions.FromString( ModsLevel_Song, a.sModifiers );