diff --git a/stepmania/src/GameState.cpp b/stepmania/src/GameState.cpp index 336457199a..f39a839058 100644 --- a/stepmania/src/GameState.cpp +++ b/stepmania/src/GameState.cpp @@ -327,6 +327,7 @@ void GameState::BeginGame() void GameState::PlayersFinalized() { + // If cards are already locked, this was already called. if( MEMCARDMAN->GetCardsLocked() ) return; @@ -1268,7 +1269,7 @@ void GameState::RebuildPlayerOptionsFromActiveAttacks( PlayerNumber pn ) m_pPlayerState[pn]->m_PlayerOptions = po; - int iSumOfAttackLevels = GetSumOfActiveAttackLevels( pn ); + int iSumOfAttackLevels = m_pPlayerState[pn]->GetSumOfActiveAttackLevels(); if( iSumOfAttackLevels > 0 ) { m_pPlayerState[pn]->m_iLastPositiveSumOfAttackLevels = iSumOfAttackLevels; @@ -1287,17 +1288,6 @@ void GameState::RemoveAllActiveAttacks() // called on end of song RemoveActiveAttacksForPlayer( p ); } -int GameState::GetSumOfActiveAttackLevels( PlayerNumber pn ) const -{ - int iSum = 0; - - for( unsigned s=0; sm_ActiveAttacks.size(); s++ ) - if( m_pPlayerState[pn]->m_ActiveAttacks[s].fSecsRemaining > 0 && m_pPlayerState[pn]->m_ActiveAttacks[s].level != NUM_ATTACK_LEVELS ) - iSum += m_pPlayerState[pn]->m_ActiveAttacks[s].level; - - return iSum; -} - template void setmin( T &a, const T &b ) { diff --git a/stepmania/src/PlayerState.cpp b/stepmania/src/PlayerState.cpp index 1fe73b51a1..0923b56882 100644 --- a/stepmania/src/PlayerState.cpp +++ b/stepmania/src/PlayerState.cpp @@ -12,6 +12,17 @@ void PlayerState::Update( float fDelta ) m_CurrentPlayerOptions.Approach( m_PlayerOptions, fDelta ); } +int PlayerState::GetSumOfActiveAttackLevels() const +{ + int iSum = 0; + + for( unsigned s=0; s 0 && m_ActiveAttacks[s].level != NUM_ATTACK_LEVELS ) + iSum += m_pPlayerState[pn]m_ActiveAttacks[s].level; + + return iSum; +} + /* * (c) 2001-2004 Chris Danford, Chris Gomez * All rights reserved. diff --git a/stepmania/src/PlayerState.h b/stepmania/src/PlayerState.h index 318a0d354a..4c3a2a354c 100644 --- a/stepmania/src/PlayerState.h +++ b/stepmania/src/PlayerState.h @@ -71,6 +71,7 @@ struct PlayerState // // Used in Battle and Rave // + int GetSumOfActiveAttackLevels() const; int m_iCpuSkill; // only used when m_PlayerController is PC_CPU // Attacks take a while to transition out of use. Account for this in PlayerAI // by still penalizing it for 1 second after the player options are rebuilt.