move GetSumOfActiveAttackLevels into PlayerState
This commit is contained in:
@@ -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; s<m_pPlayerState[pn]->m_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<class T>
|
||||
void setmin( T &a, const T &b )
|
||||
{
|
||||
|
||||
@@ -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<m_ActiveAttacks.size(); s++ )
|
||||
if( m_ActiveAttacks[s].fSecsRemaining > 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.
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user