don't have to import both players at once, so AfterImportOptions takes pn
This commit is contained in:
+16
-27
@@ -437,26 +437,19 @@ void OptionRow::InitText()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* After importing options, choose which item is focused. */
|
/* After importing options, choose which item is focused. */
|
||||||
void OptionRow::AfterImportOptions()
|
void OptionRow::AfterImportOptions( PlayerNumber pn )
|
||||||
{
|
{
|
||||||
/* We load items for both players on start, since we don't know at that point
|
/* We load items for both players on start, since we don't know at that point
|
||||||
* which players will be joined when we're displayed. Hide items for inactive
|
* which players will be joined when we're displayed. Hide items for inactive
|
||||||
* players. */
|
* players. */
|
||||||
FOREACH_PlayerNumber( p )
|
if( m_pHand->m_Def.m_layoutType == LAYOUT_SHOW_ONE_IN_ROW &&
|
||||||
{
|
!m_pHand->m_Def.m_bOneChoiceForAllPlayers )
|
||||||
if( m_pHand->m_Def.m_layoutType == LAYOUT_SHOW_ONE_IN_ROW &&
|
m_textItems[pn]->SetHidden( !GAMESTATE->IsHumanPlayer(pn) );
|
||||||
!m_pHand->m_Def.m_bOneChoiceForAllPlayers )
|
|
||||||
m_textItems[p]->SetHidden( !GAMESTATE->IsHumanPlayer(p) );
|
|
||||||
}
|
|
||||||
|
|
||||||
// Hide underlines for disabled players.
|
// Hide underlines for disabled players.
|
||||||
FOREACH_PlayerNumber( p )
|
if( !GAMESTATE->IsHumanPlayer(pn) )
|
||||||
{
|
for( unsigned c=0; c<m_Underline[pn].size(); c++ )
|
||||||
if( GAMESTATE->IsHumanPlayer(p) )
|
m_Underline[pn][c]->SetHidden( true );
|
||||||
continue;
|
|
||||||
for( unsigned c=0; c<m_Underline[p].size(); c++ )
|
|
||||||
m_Underline[p][c]->SetHidden( true );
|
|
||||||
}
|
|
||||||
|
|
||||||
// Make all selections the same if bOneChoiceForAllPlayers
|
// Make all selections the same if bOneChoiceForAllPlayers
|
||||||
// Hack: we only import active players, so if only player 2 is imported,
|
// Hack: we only import active players, so if only player 2 is imported,
|
||||||
@@ -473,24 +466,19 @@ void OptionRow::AfterImportOptions()
|
|||||||
switch( m_pHand->m_Def.m_selectType )
|
switch( m_pHand->m_Def.m_selectType )
|
||||||
{
|
{
|
||||||
case SELECT_ONE:
|
case SELECT_ONE:
|
||||||
FOREACH_PlayerNumber( p )
|
/* Make sure the row actually has a selection. */
|
||||||
|
int iSelection = GetOneSelection(pn, true);
|
||||||
|
if( iSelection == -1 )
|
||||||
{
|
{
|
||||||
/* Make sure the row actually has a selection. */
|
ASSERT( !m_vbSelected[pn].empty() );
|
||||||
int iSelection = GetOneSelection(p, true);
|
m_vbSelected[pn][0] = true;
|
||||||
if( iSelection == -1 )
|
|
||||||
{
|
|
||||||
ASSERT( !m_vbSelected[p].empty() );
|
|
||||||
m_vbSelected[p][0] = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
FOREACH_PlayerNumber( p )
|
ResetFocusFromSelection( pn );
|
||||||
ResetFocusFromSelection( p );
|
|
||||||
|
|
||||||
FOREACH_HumanPlayer( p )
|
PositionUnderlines( pn );
|
||||||
PositionUnderlines( p );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void OptionRow::PositionUnderlines( PlayerNumber pn )
|
void OptionRow::PositionUnderlines( PlayerNumber pn )
|
||||||
@@ -912,7 +900,8 @@ void OptionRow::Reload()
|
|||||||
FOREACH_HumanPlayer( p )
|
FOREACH_HumanPlayer( p )
|
||||||
vpns.push_back( p );
|
vpns.push_back( p );
|
||||||
ImportOptions( vpns );
|
ImportOptions( vpns );
|
||||||
AfterImportOptions();
|
FOREACH_HumanPlayer( p )
|
||||||
|
AfterImportOptions( p );
|
||||||
|
|
||||||
// TODO: Nothing uses this yet and it causes skips when changing options.
|
// TODO: Nothing uses this yet and it causes skips when changing options.
|
||||||
//if( m_pHand->m_Def.m_bExportOnChange )
|
//if( m_pHand->m_Def.m_bExportOnChange )
|
||||||
|
|||||||
@@ -143,7 +143,7 @@ public:
|
|||||||
int ExportOptions( const vector<PlayerNumber> &vpns, bool bRowHasFocus[NUM_PLAYERS] );
|
int ExportOptions( const vector<PlayerNumber> &vpns, bool bRowHasFocus[NUM_PLAYERS] );
|
||||||
|
|
||||||
void InitText();
|
void InitText();
|
||||||
void AfterImportOptions();
|
void AfterImportOptions( PlayerNumber pn );
|
||||||
|
|
||||||
void ChoicesChanged();
|
void ChoicesChanged();
|
||||||
void PositionUnderlines( PlayerNumber pn );
|
void PositionUnderlines( PlayerNumber pn );
|
||||||
|
|||||||
@@ -263,7 +263,8 @@ void ScreenOptions::BeginScreen()
|
|||||||
vpns.push_back( p );
|
vpns.push_back( p );
|
||||||
this->ImportOptions( r, vpns );
|
this->ImportOptions( r, vpns );
|
||||||
|
|
||||||
pRow->AfterImportOptions();
|
FOREACH_HumanPlayer( p )
|
||||||
|
pRow->AfterImportOptions( p );
|
||||||
}
|
}
|
||||||
|
|
||||||
ON_COMMAND( m_framePage );
|
ON_COMMAND( m_framePage );
|
||||||
|
|||||||
@@ -265,7 +265,7 @@ void ScreenOptionsEditCourseEntry::AfterChangeValueInRow( int iRow, PlayerNumber
|
|||||||
OptionRow &row = *m_pRows[ROW_SONG];
|
OptionRow &row = *m_pRows[ROW_SONG];
|
||||||
row.Reload();
|
row.Reload();
|
||||||
ImportOptions( ROW_SONG, vpns );
|
ImportOptions( ROW_SONG, vpns );
|
||||||
row.AfterImportOptions();
|
row.AfterImportOptions( PLAYER_1 );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user