Allow ScreenSelectProfile to Finish() with guest players

Passing a -3 as profile index to ScreenSelectProfile's SetProfileIndex now
allows a player to play without having a local or USB profile assigned.

Also adds a message (PlayerProfileSet) that's broadcast anytime a player selects
a profile or chooses to play as a guest and subscribes ScreenSelectMusic to it.
This commit is contained in:
Ivana Kellyerova
2022-06-07 19:35:30 +02:00
committed by Martin Natano
parent 64b4676a14
commit 02b9925b12
6 changed files with 19 additions and 4 deletions
+11 -2
View File
@@ -128,7 +128,7 @@ bool ScreenSelectProfile::SetProfileIndex( PlayerNumber pn, int iProfileIndex )
return false;
// wrong selection
if( iProfileIndex < -2 )
if( iProfileIndex < -3 )
return false;
// unload player
@@ -160,7 +160,7 @@ bool ScreenSelectProfile::Finish(){
FOREACH_PlayerNumber( p )
{
// not all players has made their choices
// not all players have made their choices
if( GAMESTATE->IsHumanPlayer( p ) && ( m_iSelectedProfiles[p] == -1 ) )
iUnselectedProfiles++;
@@ -209,7 +209,16 @@ bool ScreenSelectProfile::Finish(){
MEMCARDMAN->LockCard( p );
}
}
// If the player picked a profile (>= 0) or chose to play as a guest (-3),
// broadcast a message
if( m_iSelectedProfiles[p] >= 0 || m_iSelectedProfiles[p] == -3 ) {
Message msg( MessageIDToString(Message_PlayerProfileSet) );
msg.SetParam( "Player", p );
MESSAGEMAN->Broadcast( msg );
}
}
StartTransitioningScreen( SM_GoToNextScreen );
return true;
}