working on new course editor

This commit is contained in:
Chris Danford
2005-06-24 05:39:50 +00:00
parent 91e88be084
commit 94c495fa79
4 changed files with 29 additions and 13 deletions
+21 -6
View File
@@ -15,8 +15,8 @@ enum CourseManagerAction
{
ACTION_EDIT,
ACTION_DELETE,
ACTION_CREATE_NEW,
ACTION_COPY_TO_NEW,
ACTION_CREATE_NEW,
NUM_CourseManagerAction
};
static const CString CourseManagerActionNames[] = {
@@ -27,6 +27,20 @@ static const CString CourseManagerActionNames[] = {
};
XToString( CourseManagerAction, NUM_CourseManagerAction );
static void GetPossibleActions( Course *pCourse, vector<CourseManagerAction> &vActionsOut )
{
if( pCourse )
{
vActionsOut.push_back( ACTION_EDIT );
vActionsOut.push_back( ACTION_DELETE );
vActionsOut.push_back( ACTION_COPY_TO_NEW );
}
else
{
vActionsOut.push_back( ACTION_CREATE_NEW );
}
}
REGISTER_SCREEN_CLASS( ScreenCourseManager );
ScreenCourseManager::ScreenCourseManager( CString sName ) : ScreenOptions( sName )
@@ -96,6 +110,7 @@ void ScreenCourseManager::OnChange( PlayerNumber pn )
FOREACH_CONST( Course*, vpCourses, c )
def.choices.push_back( (*c)->GetTranslitFullTitle() );
def.choices.push_back( NULL ); // new course
row.Reload( def );
}
// fall through
case ROW_COURSE:
@@ -111,13 +126,13 @@ void ScreenCourseManager::OnChange( PlayerNumber pn )
// refresh actions
{
OptionRow &row = *m_pRows[ROW_ACTION];
vector<Course*> vpCourses;
SONGMAN->GetCoursesInGroup( vpCourses, GAMESTATE->m_sPreferredCourseGroup.Get(), false );
OptionRowDefinition def = row.GetRowDef();
def.choices.clear();
FOREACH_CONST( Course*, vpCourses, c )
def.choices.push_back( (*c)->GetTranslitFullTitle() );
def.choices.push_back( NULL ); // new course
vector<CourseManagerAction> vActions;
GetPossibleActions( GAMESTATE->m_pCurCourse, vActions );
FOREACH_CONST( CourseManagerAction, vActions, a )
def.choices.push_back( CourseManagerActionToString(*a) );
row.Reload( def );
}
// fall through
case ROW_ACTION: