fix crash that happened when LateJoin and Doubles for 1 Credit were enabled and Doubles was selected ("No compatible styles for [insert game and styletype] with 2 players.").

todo: The non-master player's CreditsDisplay still shows "Insert Card", unlike themes without LateJoin on. Not sure how to go about fixing this; hoped SetCurrentStyle(Style) would've done it but was not the case.
This commit is contained in:
AJ Kelly
2009-05-23 05:59:41 +00:00
parent fd5f5d38f4
commit c6e6ad24ad
+10 -2
View File
@@ -354,8 +354,16 @@ void GameState::JoinPlayer( PlayerNumber pn )
// Set the current style to something appropriate for the new number of joined players.
if( ALLOW_LATE_JOIN && m_pCurStyle != NULL )
{
const Style *pStyle = GameManager::GetFirstCompatibleStyle( m_pCurGame, GetNumSidesJoined(), m_pCurStyle->m_StepsType );
m_pCurStyle.Set( pStyle );
const Style *pStyle;
// only use one player for StyleType_OnePlayerTwoSides.
// XXX: still shows non master player's "Insert Card" -aj
if( m_pCurStyle->m_StyleType == StyleType_OnePlayerTwoSides )
pStyle = GameManager::GetFirstCompatibleStyle( m_pCurGame, 1, m_pCurStyle->m_StepsType );
else
pStyle = GameManager::GetFirstCompatibleStyle( m_pCurGame, GetNumSidesJoined(), m_pCurStyle->m_StepsType );
// use SetCurrentStyle in case of StyleType_OnePlayerTwoSides
SetCurrentStyle( pStyle );
}
Message msg( MessageIDToString(Message_PlayerJoined) );