fix GAMESTATE->m_iCpuSkill going out of bounds
This commit is contained in:
@@ -82,8 +82,8 @@ TapNoteScore PlayerAI::GetTapNoteScore( PlayerNumber pn )
|
|||||||
GAMESTATE->m_iLastPositiveSumOfAttackLevels[pn] :
|
GAMESTATE->m_iLastPositiveSumOfAttackLevels[pn] :
|
||||||
0;
|
0;
|
||||||
|
|
||||||
ASSERT( iCpuSkill>=0 && iCpuSkill<NUM_SKILL_LEVELS );
|
ASSERT_M( iCpuSkill>=0 && iCpuSkill<NUM_SKILL_LEVELS, ssprintf("%i", iCpuSkill) );
|
||||||
ASSERT( GAMESTATE->m_PlayerController[pn] == PC_CPU );
|
ASSERT_M( GAMESTATE->m_PlayerController[pn] == PC_CPU, ssprintf("%i", GAMESTATE->m_PlayerController[pn]) );
|
||||||
|
|
||||||
iCpuSkill -= iSumOfAttackLevels*3;
|
iCpuSkill -= iSumOfAttackLevels*3;
|
||||||
CLAMP( iCpuSkill, 0, NUM_SKILL_LEVELS-1 );
|
CLAMP( iCpuSkill, 0, NUM_SKILL_LEVELS-1 );
|
||||||
|
|||||||
@@ -933,6 +933,8 @@ void ScreenGameplay::LoadNextSong()
|
|||||||
GAMESTATE->m_PlayerController[p] = PC_CPU;
|
GAMESTATE->m_PlayerController[p] = PC_CPU;
|
||||||
int iMeter = GAMESTATE->m_pCurNotes[p]->GetMeter();
|
int iMeter = GAMESTATE->m_pCurNotes[p]->GetMeter();
|
||||||
int iNewSkill = SCALE( iMeter, MIN_METER, MAX_METER, 0, NUM_SKILL_LEVELS-1 );
|
int iNewSkill = SCALE( iMeter, MIN_METER, MAX_METER, 0, NUM_SKILL_LEVELS-1 );
|
||||||
|
/* Watch out: songs aren't actually bound by MAX_METER. */
|
||||||
|
iNewSkill = clamp( iNewSkill, 0, NUM_SKILL_LEVELS-1 );
|
||||||
GAMESTATE->m_iCpuSkill[p] = iNewSkill;
|
GAMESTATE->m_iCpuSkill[p] = iNewSkill;
|
||||||
}
|
}
|
||||||
else if( PREFSMAN->m_bAutoPlay )
|
else if( PREFSMAN->m_bAutoPlay )
|
||||||
|
|||||||
Reference in New Issue
Block a user