From bddbed7e7eca6785ed208831feb0df3ec00f400f Mon Sep 17 00:00:00 2001 From: Jason Felds Date: Thu, 27 Dec 2012 11:13:41 -0500 Subject: [PATCH] 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. --- src/Attack.h | 6 +++--- src/Player.cpp | 2 +- src/PlayerState.cpp | 4 ++-- src/ScreenGameplay.cpp | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Attack.h b/src/Attack.h index 2311e4231a..20ff432fe5 100644 --- a/src/Attack.h +++ b/src/Attack.h @@ -8,7 +8,7 @@ class PlayerState; /** @brief An action made against a Player to make things more difficult. */ struct Attack { - static const int ATTACK_STARTS_NOW = -10000; + static const inline float ATTACK_STARTS_NOW() { return -10000.f; } AttackLevel level; /** @@ -27,14 +27,14 @@ struct Attack void MakeBlank() { level = ATTACK_LEVEL_1; - fStartSecond = ATTACK_STARTS_NOW; + fStartSecond = ATTACK_STARTS_NOW(); fSecsRemaining = 0; sModifiers = RString(); bOn = false; bGlobal = false; bShowInAttackList = true; } - Attack(): level(ATTACK_LEVEL_1), fStartSecond(ATTACK_STARTS_NOW), + Attack(): level(ATTACK_LEVEL_1), fStartSecond(ATTACK_STARTS_NOW()), fSecsRemaining(0), sModifiers(RString()), bOn(false), bGlobal(false), bShowInAttackList(true) {} // MakeBlank() is effectively called here. diff --git a/src/Player.cpp b/src/Player.cpp index c61eb32b4d..826226df1f 100644 --- a/src/Player.cpp +++ b/src/Player.cpp @@ -2858,7 +2858,7 @@ void Player::UpdateJudgedRows() Attack attMineAttack; attMineAttack.sModifiers = ApplyRandomAttack(); - attMineAttack.fStartSecond = attMineAttack.ATTACK_STARTS_NOW; + attMineAttack.fStartSecond = attMineAttack.ATTACK_STARTS_NOW(); attMineAttack.fSecsRemaining = fAttackRunTime; m_pPlayerState->LaunchAttack( attMineAttack ); diff --git a/src/PlayerState.cpp b/src/PlayerState.cpp index f0783119cf..68016ebb34 100644 --- a/src/PlayerState.cpp +++ b/src/PlayerState.cpp @@ -66,7 +66,7 @@ void PlayerState::Update( float fDelta ) // You must add sattack by calling GameState::LaunchAttack, // or else the sentinel value won't be // converted into the current music time. - ASSERT( attack.fStartSecond != attack.ATTACK_STARTS_NOW ); + ASSERT( attack.fStartSecond != attack.ATTACK_STARTS_NOW() ); bool bCurrentlyEnabled = 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, * so Player::Update knows to apply attack transforms correctly. (yuck) */ 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; m_ActiveAttacks.push_back( attack ); diff --git a/src/ScreenGameplay.cpp b/src/ScreenGameplay.cpp index a7569bd84a..796253ec79 100644 --- a/src/ScreenGameplay.cpp +++ b/src/ScreenGameplay.cpp @@ -979,7 +979,7 @@ void ScreenGameplay::SetupSong( int iSongIndex ) Attack a = pi->m_asModifiersQueue[iSongIndex][i]; if( a.fStartSecond != 0 ) continue; - a.fStartSecond = a.ATTACK_STARTS_NOW; // now + a.fStartSecond = a.ATTACK_STARTS_NOW(); // now PlayerOptions po; po.FromString( a.sModifiers ); @@ -1029,7 +1029,7 @@ void ScreenGameplay::SetupSong( int iSongIndex ) { Attack a = pi->m_asModifiersQueue[iSongIndex][i]; if( a.fStartSecond == 0 ) - a.fStartSecond = a.ATTACK_STARTS_NOW; // now + a.fStartSecond = a.ATTACK_STARTS_NOW(); // now pi->GetPlayerState()->LaunchAttack( a ); GAMESTATE->m_SongOptions.FromString( ModsLevel_Song, a.sModifiers );