fix crash when selecting course mods in editor

This commit is contained in:
Chris Danford
2006-08-15 21:18:23 +00:00
parent c36f33c088
commit 42d279926b
2 changed files with 13 additions and 0 deletions
+2
View File
@@ -542,6 +542,8 @@ void NoteField::DrawPrimitives()
const Course *pCourse = GAMESTATE->m_pCurCourse;
if( pCourse )
{
ASSERT_M( GAMESTATE->m_iEditCourseEntryIndex > 0 && GAMESTATE->m_iEditCourseEntryIndex < (int)pCourse->m_vEntries.size(),
ssprintf("%i",GAMESTATE->m_iEditCourseEntryIndex.Get()) );
const CourseEntry &ce = pCourse->m_vEntries[GAMESTATE->m_iEditCourseEntryIndex];
FOREACH_CONST( Attack, ce.attacks, a )
{
+11
View File
@@ -2406,7 +2406,18 @@ void ScreenEdit::HandleScreenMessage( const ScreenMessage SM )
{
const RString name = g_CourseMode.rows[0].choices[num];
Course *pCourse = SONGMAN->FindCourse( name );
int iCourseEntryIndex = -1;
FOREACH_CONST( CourseEntry, pCourse->m_vEntries, i )
{
if( i->pSong == GAMESTATE->m_pCurSong.Get() )
iCourseEntryIndex = i - pCourse->m_vEntries.begin();
}
ASSERT( iCourseEntryIndex != -1 );
GAMESTATE->m_pCurCourse.Set( pCourse );
GAMESTATE->m_iEditCourseEntryIndex.Set( iCourseEntryIndex );
ASSERT( GAMESTATE->m_pCurCourse );
}
}