From 4f0c3e36de805708722021bef8167bd150fd7cbe Mon Sep 17 00:00:00 2001 From: Steve Checkoway Date: Tue, 14 Mar 2006 08:33:49 +0000 Subject: [PATCH] Don't rely on the trail here since a particular entry might not be in any given trail. Try hard to get the specific st/cd combination, if all else fails, get any valid, non-autogenerated steps. Also reset the course and trail when anything changes to update overlays. --- .../src/ScreenOptionsEditCourseEntry.cpp | 28 ++++++++++++++++--- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/stepmania/src/ScreenOptionsEditCourseEntry.cpp b/stepmania/src/ScreenOptionsEditCourseEntry.cpp index 7fbf8a732b..0c0114d1e6 100644 --- a/stepmania/src/ScreenOptionsEditCourseEntry.cpp +++ b/stepmania/src/ScreenOptionsEditCourseEntry.cpp @@ -229,10 +229,25 @@ void ScreenOptionsEditCourseEntry::HandleScreenMessage( const ScreenMessage SM ) case ROW_SET_MODS: if( SHOW_MODS_ROW ) { - Trail *pTrail = GAMESTATE->m_pCurTrail[PLAYER_1]; - TrailEntry *pTrailEntry = &pTrail->m_vEntries[GAMESTATE->m_iEditCourseEntryIndex]; - Song *pSong = pTrailEntry->pSong; - Steps *pSteps = pTrailEntry->pSteps; + /* We can't rely on the trail here since it depends on what steps are available. + * Use the course entry directly instead. */ + CourseEntry& ce = pCourse->m_vEntries[GAMESTATE->m_iEditCourseEntryIndex]; + Song *pSong = ce.pSong; + Steps *pSteps; + StepsType st = GAMESTATE->m_stEdit; + CourseDifficulty cd = ( ce.baseDifficulty == DIFFICULTY_INVALID ? + GAMESTATE->m_cdEdit : ce.baseDifficulty ); + + ASSERT( pSong ); + // Try to find steps first using st and cd, then st, then cd, then any. + pSteps = pSong->GetStepsByDifficulty( st, cd, false ); + if( !pSteps ) + pSteps = pSong->GetStepsByDifficulty( st, DIFFICULTY_INVALID, false ); + if( !pSteps ) + pSteps = pSong->GetStepsByDifficulty( STEPS_TYPE_INVALID, cd, false ); + if( !pSteps ) + pSteps = pSong->GetStepsByDifficulty( STEPS_TYPE_INVALID, DIFFICULTY_INVALID, false ); + ASSERT( pSteps ); // Set up for ScreenEdit const Style *pStyle = GAMEMAN->GetEditorStyleForStepsType(pSteps->m_StepsType); @@ -241,6 +256,7 @@ void ScreenOptionsEditCourseEntry::HandleScreenMessage( const ScreenMessage SM ) GAMESTATE->m_pCurSteps[PLAYER_1].Set( pSteps ); break; } + // fall through case ROW_DONE: m_Original = pCourse->m_vEntries[ GAMESTATE->m_iEditCourseEntryIndex ]; SCREENMAN->SetNewScreen( "ScreenOptionsEditCourse" ); @@ -460,6 +476,10 @@ void ScreenOptionsEditCourseEntry::ExportOptions( int iRow, const vectorGetTrailForceRegenCache( GAMESTATE->m_stEdit, GAMESTATE->m_cdEdit ); + + GAMESTATE->m_pCurCourse.Set( pCourse ); + GAMESTATE->m_pCurTrail[PLAYER_1].Set( pTrail ); } void ScreenOptionsEditCourseEntry::ProcessMenuStart( const InputEventPlus &input )