Split out ResetFocusFromSelection.
Don't reset m_iChoiceInRowWithFocus in ResetFocusFromSelection for SELECT_MULTIPLE or SELECT_NONE. That's done by ChoicesChanged.
This commit is contained in:
+21
-16
@@ -483,28 +483,14 @@ void OptionRow::AfterImportOptions()
|
||||
{
|
||||
ASSERT( !m_vbSelected[p].empty() );
|
||||
m_vbSelected[p][0] = true;
|
||||
iSelection = 0;
|
||||
}
|
||||
|
||||
m_iChoiceInRowWithFocus[p] = iSelection; // focus on the selection we just set
|
||||
}
|
||||
break;
|
||||
case SELECT_MULTIPLE:
|
||||
case SELECT_NONE:
|
||||
m_iChoiceInRowWithFocus[p] = 0;
|
||||
break;
|
||||
default:
|
||||
ASSERT(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// HACK: Set focus to one item in the row, which is "go down"
|
||||
//
|
||||
if( m_bFirstItemGoesDown )
|
||||
FOREACH_PlayerNumber( p )
|
||||
m_iChoiceInRowWithFocus[p] = 0;
|
||||
FOREACH_PlayerNumber( p )
|
||||
ResetFocusFromSelection( p );
|
||||
|
||||
UpdateText();
|
||||
|
||||
@@ -858,6 +844,25 @@ void OptionRow::SetChoiceInRowWithFocusShared( int iChoice )
|
||||
SetChoiceInRowWithFocus( pn, iChoice );
|
||||
}
|
||||
|
||||
void OptionRow::ResetFocusFromSelection( PlayerNumber pn )
|
||||
{
|
||||
switch( m_pHand->m_Def.m_selectType )
|
||||
{
|
||||
case SELECT_ONE:
|
||||
/* Import the focus from the selected option. */
|
||||
int iSelection = GetOneSelection( pn, true );
|
||||
m_iChoiceInRowWithFocus[pn] = iSelection; // focus on the selection we just set
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// HACK: Set focus to one item in the row, which is "go down"
|
||||
//
|
||||
if( m_bFirstItemGoesDown )
|
||||
FOREACH_PlayerNumber( p )
|
||||
m_iChoiceInRowWithFocus[p] = 0;
|
||||
}
|
||||
|
||||
bool OptionRow::GetSelected( PlayerNumber pn, int iChoice ) const
|
||||
{
|
||||
if( m_pHand->m_Def.m_bOneChoiceForAllPlayers )
|
||||
|
||||
@@ -162,6 +162,7 @@ public:
|
||||
int GetChoiceInRowWithFocusShared() const;
|
||||
void SetChoiceInRowWithFocus( PlayerNumber pn, int iChoice );
|
||||
void SetChoiceInRowWithFocusShared( int iChoice );
|
||||
void ResetFocusFromSelection( PlayerNumber pn );
|
||||
|
||||
bool GetSelected( PlayerNumber pn, int iChoice ) const;
|
||||
void SetSelected( PlayerNumber pn, int iChoice, bool b );
|
||||
|
||||
Reference in New Issue
Block a user