restore logic that was lost in previous changes:

Set the new m_iChoice even for disabled players, since a player might join on a SHARED_SELECTION after the cursor has been moved.
This commit is contained in:
Chris Danford
2007-06-11 19:18:13 +00:00
parent 9a41d096ef
commit 2019db103e
+17 -20
View File
@@ -557,25 +557,22 @@ bool ScreenSelectMaster::ChangeSelection( PlayerNumber pn, MenuDir dir, int iNew
return ChangePage( iNewChoice ); return ChangePage( iNewChoice );
vector<PlayerNumber> vpns; vector<PlayerNumber> vpns;
if( SHARED_SELECTION ) if( SHARED_SELECTION || page != PAGE_1 )
{
vpns.push_back( PLAYER_1 );
}
else if( page == PAGE_1 )
{ {
/* Set the new m_iChoice even for disabled players, since a player might
* join on a SHARED_SELECTION after the cursor has been moved. */
FOREACH_HumanPlayer( pn )
vpns.push_back( pn ); vpns.push_back( pn );
} }
else else
{ {
FOREACH_HumanPlayer( pn )
vpns.push_back( pn ); vpns.push_back( pn );
} }
FOREACH( PlayerNumber, vpns, pn ) FOREACH( PlayerNumber, vpns, p )
{ {
PlayerNumber p = *pn; const int iOldChoice = m_iChoice[*p];
const int iOldChoice = m_iChoice[p]; m_iChoice[*p] = iNewChoice;
m_iChoice[p] = iNewChoice;
if( SHOW_ICON ) if( SHOW_ICON )
{ {
@@ -584,12 +581,12 @@ bool ScreenSelectMaster::ChangeSelection( PlayerNumber pn, MenuDir dir, int iNew
* What is SharedPreviewAndCursor? -- Steve */ * What is SharedPreviewAndCursor? -- Steve */
bool bOldStillHasFocus = false; bool bOldStillHasFocus = false;
bool bNewAlreadyHadFocus = false; bool bNewAlreadyHadFocus = false;
FOREACH_HumanPlayer( pn ) FOREACH_HumanPlayer( p2 )
{ {
if( pn == p ) if( p2 == *p )
continue; continue;
bOldStillHasFocus = bOldStillHasFocus || m_iChoice[pn] == iOldChoice; bOldStillHasFocus |= m_iChoice[p2] == iOldChoice;
bNewAlreadyHadFocus = bNewAlreadyHadFocus || m_iChoice[pn] == iNewChoice; bNewAlreadyHadFocus |= m_iChoice[p2] == iNewChoice;
} }
if( !bOldStillHasFocus ) if( !bOldStillHasFocus )
m_vsprIcon[iOldChoice]->PlayCommand( "LoseFocus" ); m_vsprIcon[iOldChoice]->PlayCommand( "LoseFocus" );
@@ -599,8 +596,8 @@ bool ScreenSelectMaster::ChangeSelection( PlayerNumber pn, MenuDir dir, int iNew
if( SHOW_CURSOR ) if( SHOW_CURSOR )
{ {
m_sprCursor[p]->PlayCommand( "Change" ); m_sprCursor[*p]->PlayCommand( "Change" );
m_sprCursor[p]->SetXY( GetCursorX(p), GetCursorY(p) ); m_sprCursor[*p]->SetXY( GetCursorX(*p), GetCursorY(*p) );
} }
if( SHOW_SCROLLER ) if( SHOW_SCROLLER )
@@ -614,7 +611,7 @@ bool ScreenSelectMaster::ChangeSelection( PlayerNumber pn, MenuDir dir, int iNew
if( iPressedDir != iActualDir ) // wrapped if( iPressedDir != iActualDir ) // wrapped
{ {
ActorScroller &scroller = SHARED_SELECTION ? m_Scroller[0] : m_Scroller[p]; ActorScroller &scroller = SHARED_SELECTION ? m_Scroller[0] : m_Scroller[*p];
float fItem = scroller.GetCurrentItem(); float fItem = scroller.GetCurrentItem();
int iNumChoices = m_aGameCommands.size(); int iNumChoices = m_aGameCommands.size();
fItem += iActualDir * iNumChoices; fItem += iActualDir * iNumChoices;
@@ -622,10 +619,10 @@ bool ScreenSelectMaster::ChangeSelection( PlayerNumber pn, MenuDir dir, int iNew
} }
} }
m_Scroller[p].SetDestinationItem( (float)iNewChoice ); m_Scroller[*p].SetDestinationItem( (float)iNewChoice );
m_vsprScroll[p][iOldChoice]->PlayCommand( "LoseFocus" ); m_vsprScroll[*p][iOldChoice]->PlayCommand( "LoseFocus" );
m_vsprScroll[p][iNewChoice]->PlayCommand( "GainFocus" ); m_vsprScroll[*p][iNewChoice]->PlayCommand( "GainFocus" );
} }
} }