persist PreferredDifficulty in Profile
This commit is contained in:
+26
-14
@@ -198,15 +198,18 @@ void GameState::PlayersFinalized()
|
||||
// apply saved default modifiers if any
|
||||
FOREACH_HumanPlayer( pn )
|
||||
{
|
||||
if( PROFILEMAN->IsUsingProfile(pn) )
|
||||
if( !PROFILEMAN->IsUsingProfile(pn) )
|
||||
continue; // skip
|
||||
|
||||
Profile* pProfile = PROFILEMAN->GetProfile(pn);
|
||||
|
||||
if( pProfile->m_bUsingProfileDefaultModifiers )
|
||||
{
|
||||
Profile* pProfile = PROFILEMAN->GetProfile(pn);
|
||||
if( pProfile->m_bUsingProfileDefaultModifiers )
|
||||
{
|
||||
GAMESTATE->m_PlayerOptions[pn].Init();
|
||||
GAMESTATE->ApplyModifiers( pn, pProfile->m_sDefaultModifiers );
|
||||
}
|
||||
GAMESTATE->m_PlayerOptions[pn].Init();
|
||||
GAMESTATE->ApplyModifiers( pn, pProfile->m_sDefaultModifiers );
|
||||
}
|
||||
if( pProfile->m_PreferredDifficulty != DIFFICULTY_INVALID )
|
||||
GAMESTATE->m_PreferredDifficulty[pn] = pProfile->m_PreferredDifficulty;
|
||||
}
|
||||
|
||||
|
||||
@@ -288,19 +291,28 @@ void GameState::EndGame()
|
||||
|
||||
CHECKPOINT;
|
||||
}
|
||||
CHECKPOINT;
|
||||
MEMCARDMAN->FlushAllDisks();
|
||||
CHECKPOINT;
|
||||
|
||||
BOOKKEEPER->WriteToDisk();
|
||||
PROFILEMAN->SaveMachineProfile();
|
||||
|
||||
for( p=0; p<NUM_PLAYERS; p++ )
|
||||
FOREACH_HumanPlayer( pn )
|
||||
{
|
||||
PROFILEMAN->SaveProfile( (PlayerNumber)p );
|
||||
PROFILEMAN->UnloadProfile( (PlayerNumber)p );
|
||||
if( !PROFILEMAN->IsUsingProfile(pn) )
|
||||
continue;
|
||||
|
||||
Profile* pProfile = PROFILEMAN->GetProfile(pn);
|
||||
|
||||
// persist current settings
|
||||
pProfile->m_PreferredDifficulty = m_PreferredDifficulty[pn];
|
||||
|
||||
PROFILEMAN->SaveProfile( pn );
|
||||
PROFILEMAN->UnloadProfile( pn );
|
||||
}
|
||||
|
||||
// Reset the USB storage device numbers -after- saving
|
||||
CHECKPOINT;
|
||||
MEMCARDMAN->FlushAllDisks();
|
||||
CHECKPOINT;
|
||||
|
||||
SONGMAN->FreeAllLoadedFromProfiles();
|
||||
}
|
||||
|
||||
|
||||
@@ -69,6 +69,7 @@ void Profile::InitGeneralData()
|
||||
m_bUsingProfileDefaultModifiers = false;
|
||||
m_sDefaultModifiers = "";
|
||||
m_SortOrder = SORT_INVALID;
|
||||
m_PreferredDifficulty = DIFFICULTY_INVALID;
|
||||
m_iTotalPlays = 0;
|
||||
m_iTotalPlaySeconds = 0;
|
||||
m_iTotalGameplaySeconds = 0;
|
||||
@@ -567,7 +568,8 @@ XNode* Profile::SaveGeneralDataCreateNode() const
|
||||
|
||||
pGeneralDataNode->AppendChild( "UsingProfileDefaultModifiers", m_bUsingProfileDefaultModifiers );
|
||||
pGeneralDataNode->AppendChild( "DefaultModifiers", m_sDefaultModifiers );
|
||||
pGeneralDataNode->AppendChild( "SortOrder", SortOrderToString(m_SortOrder) );
|
||||
pGeneralDataNode->AppendChild( "SortOrder", SortOrderToString(m_SortOrder) );
|
||||
pGeneralDataNode->AppendChild( "PreferredDifficulty", DifficultyToString(m_PreferredDifficulty) );
|
||||
pGeneralDataNode->AppendChild( "TotalPlays", m_iTotalPlays );
|
||||
pGeneralDataNode->AppendChild( "TotalPlaySeconds", m_iTotalPlaySeconds );
|
||||
pGeneralDataNode->AppendChild( "TotalGameplaySeconds", m_iTotalGameplaySeconds );
|
||||
@@ -702,9 +704,11 @@ void Profile::LoadGeneralDataFromNode( const XNode* pNode )
|
||||
|
||||
pNode->GetChildValue( "UsingProfileDefaultModifiers", m_bUsingProfileDefaultModifiers );
|
||||
pNode->GetChildValue( "DefaultModifiers", m_sDefaultModifiers );
|
||||
CString sSortOrder;
|
||||
pNode->GetChildValue( "SortOrder", sSortOrder );
|
||||
m_SortOrder = StringToSortOrder( sSortOrder );
|
||||
CString s;
|
||||
pNode->GetChildValue( "SortOrder", s );
|
||||
m_SortOrder = StringToSortOrder( s );
|
||||
pNode->GetChildValue( "PreferredDifficulty", s );
|
||||
m_PreferredDifficulty = StringToDifficulty( s );
|
||||
pNode->GetChildValue( "TotalPlays", m_iTotalPlays );
|
||||
pNode->GetChildValue( "TotalPlaySeconds", m_iTotalPlaySeconds );
|
||||
pNode->GetChildValue( "TotalGameplaySeconds", m_iTotalGameplaySeconds );
|
||||
|
||||
@@ -89,6 +89,7 @@ public:
|
||||
bool m_bUsingProfileDefaultModifiers;
|
||||
CString m_sDefaultModifiers;
|
||||
SortOrder m_SortOrder;
|
||||
Difficulty m_PreferredDifficulty;
|
||||
int m_iTotalPlays;
|
||||
int m_iTotalPlaySeconds;
|
||||
int m_iTotalGameplaySeconds;
|
||||
|
||||
Reference in New Issue
Block a user