diff --git a/stepmania/src/ScreenOptionsMaster.cpp b/stepmania/src/ScreenOptionsMaster.cpp index 843573e47a..3f1acded54 100644 --- a/stepmania/src/ScreenOptionsMaster.cpp +++ b/stepmania/src/ScreenOptionsMaster.cpp @@ -152,8 +152,7 @@ void ScreenOptionsMaster::SetConf( OptionRow &row, OptionRowHandler &hand, CStri if( hand.opt == NULL ) RageException::Throw( "Invalid Conf type \"%s\"", param.c_str() ); - for( unsigned i = 0; i < hand.opt->names.size(); ++i ) - row.choices.push_back( hand.opt->names[i] ); + hand.opt->MakeOptionsList( row.choices ); TitleOut = hand.opt->name; } diff --git a/stepmania/src/ScreenOptionsMasterPrefs.cpp b/stepmania/src/ScreenOptionsMasterPrefs.cpp index b15bb83bdb..bfe878dedd 100644 --- a/stepmania/src/ScreenOptionsMasterPrefs.cpp +++ b/stepmania/src/ScreenOptionsMasterPrefs.cpp @@ -51,3 +51,14 @@ const ConfOption *FindConfOption( CString name ) return NULL; } +void ConfOption::MakeOptionsList( CStringArray &out ) const +{ + if( MakeOptionsListCB == NULL ) + { + out = names; + return; + } + + MakeOptionsListCB( out ); +} + diff --git a/stepmania/src/ScreenOptionsMasterPrefs.h b/stepmania/src/ScreenOptionsMasterPrefs.h index 21b6ee9818..be97d4ee3a 100644 --- a/stepmania/src/ScreenOptionsMasterPrefs.h +++ b/stepmania/src/ScreenOptionsMasterPrefs.h @@ -8,19 +8,27 @@ struct ConfOption * be the default display title. */ CString name; void (*MoveData)( int &sel, bool ToSel ); + + /* If MakeOptionsListCB is set, it'll be called by MakeOptionsList; otherwise + * the contents of names is returned. */ + void MakeOptionsList( CStringArray &out ) const; + inline int Get() const { int sel; MoveData( sel, true ); return sel; } inline void Put( int sel ) const { MoveData( sel, false ); } - vector names; ConfOption( const char *n, void (*m)( int &sel, bool in ), const char *c0=NULL, const char *c1=NULL, const char *c2=NULL, const char *c3=NULL, const char *c4=NULL, const char *c5=NULL, const char *c6=NULL, const char *c7=NULL, const char *c8=NULL, const char *c9=NULL, const char *c10=NULL, const char *c11=NULL, const char *c12=NULL, const char *c13=NULL, const char *c14=NULL, const char *c15=NULL, const char *c16=NULL, const char *c17=NULL, const char *c18=NULL, const char *c19=NULL ) { name = n; MoveData = m; + MakeOptionsListCB = NULL; #define PUSH( c ) if(c) names.push_back(c); PUSH(c0);PUSH(c1);PUSH(c2);PUSH(c3);PUSH(c4);PUSH(c5);PUSH(c6);PUSH(c7);PUSH(c8);PUSH(c9);PUSH(c10);PUSH(c11);PUSH(c12);PUSH(c13);PUSH(c14);PUSH(c15);PUSH(c16);PUSH(c17);PUSH(c18);PUSH(c19); #undef PUSH } +private: + vector names; + void (*MakeOptionsListCB)( CStringArray &out ); }; const ConfOption *FindConfOption( CString name );