fix GAMESTATE->m_iCpuSkill going out of bounds

This commit is contained in:
Glenn Maynard
2004-04-09 02:16:34 +00:00
parent c190b2e6c5
commit a0efc346bd
2 changed files with 4 additions and 2 deletions
+2 -2
View File
@@ -82,8 +82,8 @@ TapNoteScore PlayerAI::GetTapNoteScore( PlayerNumber pn )
GAMESTATE->m_iLastPositiveSumOfAttackLevels[pn] :
0;
ASSERT( iCpuSkill>=0 && iCpuSkill<NUM_SKILL_LEVELS );
ASSERT( GAMESTATE->m_PlayerController[pn] == PC_CPU );
ASSERT_M( iCpuSkill>=0 && iCpuSkill<NUM_SKILL_LEVELS, ssprintf("%i", iCpuSkill) );
ASSERT_M( GAMESTATE->m_PlayerController[pn] == PC_CPU, ssprintf("%i", GAMESTATE->m_PlayerController[pn]) );
iCpuSkill -= iSumOfAttackLevels*3;
CLAMP( iCpuSkill, 0, NUM_SKILL_LEVELS-1 );
+2
View File
@@ -933,6 +933,8 @@ void ScreenGameplay::LoadNextSong()
GAMESTATE->m_PlayerController[p] = PC_CPU;
int iMeter = GAMESTATE->m_pCurNotes[p]->GetMeter();
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;
}
else if( PREFSMAN->m_bAutoPlay )