instead of loading actors inside OptionRow, load a single copy of each
one we need, and then make copies as needed. This avoids lots of extra loading (which can be slow, even with refcounted data; lots of path lookups, etc). (Trying to get this to the point where we can construct new OptionRows for a menu without making a whole new menu.) This approach means we don't lose the potential to have different sTypes of OptionRow in a single menu. (The annoying bit is that any actor we copy has to handle copying, which is tricky for ActorFrame and doesn't work yet for AutoActor. Working on it ...)
This commit is contained in:
@@ -206,10 +206,15 @@ void ScreenOptions::InitMenu( const vector<OptionRowDefinition> &vDefs, const ve
|
||||
|
||||
ASSERT( vDefs.size() == vHands.size() );
|
||||
|
||||
m_OptionRowType.Load( m_sName );
|
||||
|
||||
for( unsigned r=0; r<vDefs.size(); r++ ) // foreach row
|
||||
{
|
||||
m_pRows.push_back( new OptionRow() );
|
||||
m_pRows.push_back( new OptionRow(&m_OptionRowType) );
|
||||
OptionRow &row = *m_pRows.back();
|
||||
row.SetDrawOrder( 1 );
|
||||
m_framePage.AddChild( &row );
|
||||
|
||||
const OptionRowDefinition &def = vDefs[r];
|
||||
OptionRowHandler* hand = vHands[r];
|
||||
|
||||
@@ -229,17 +234,10 @@ void ScreenOptions::InitMenu( const vector<OptionRowDefinition> &vDefs, const ve
|
||||
row.AfterImportOptions();
|
||||
}
|
||||
|
||||
for( unsigned r=0; r<m_pRows.size(); r++ ) // foreach row
|
||||
{
|
||||
OptionRow &row = *m_pRows[r];
|
||||
row.SetDrawOrder( 1 );
|
||||
m_framePage.AddChild( &row );
|
||||
}
|
||||
|
||||
if( SHOW_EXIT_ROW )
|
||||
{
|
||||
// TRICKY: Add "EXIT" item
|
||||
m_pRows.push_back( new OptionRow() );
|
||||
m_pRows.push_back( new OptionRow(&m_OptionRowType) );
|
||||
OptionRow &row = *m_pRows.back();
|
||||
row.LoadMetrics( m_sName );
|
||||
row.LoadExit();
|
||||
|
||||
Reference in New Issue
Block a user