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