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
@@ -0,0 +1 @@
_shared menu header
+6 -6
View File
@@ -697,15 +697,12 @@ void OptionRow::SetExitText( CString sExitText )
bt->SetText( sExitText );
}
void OptionRow::Reload()
void OptionRow::Reload( const OptionRowDefinition &def )
{
switch( GetRowType() )
{
case OptionRow::ROW_NORMAL:
{
if( m_pHand == NULL )
return;
vector<PlayerNumber> vpns;
FOREACH_HumanPlayer( p )
vpns.push_back( p );
@@ -718,7 +715,10 @@ void OptionRow::Reload()
// ExportOptions( vpns, bRowHasFocus );
//}
m_pHand->Reload( m_RowDef );
if( m_pHand == NULL )
m_RowDef = def;
else
m_pHand->Reload( m_RowDef );
ASSERT( !m_RowDef.choices.empty() );
FOREACH_PlayerNumber( p )
@@ -765,7 +765,7 @@ void OptionRow::Reload()
void OptionRow::HandleMessage( const CString& sMessage )
{
Reload();
Reload( m_RowDef );
}
+1 -1
View File
@@ -160,7 +160,7 @@ public:
void SetExitText( CString sExitText );
void Reload();
void Reload( const OptionRowDefinition &def );
//
// Messages
+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: