diff --git a/stepmania/src/GameCommand.cpp b/stepmania/src/GameCommand.cpp index 2dc85151c1..a3682ac943 100644 --- a/stepmania/src/GameCommand.cpp +++ b/stepmania/src/GameCommand.cpp @@ -139,7 +139,7 @@ bool GameCommand::DescribesCurrentMode( PlayerNumber pn ) const return false; if( m_GoalType != GOAL_INVALID && PROFILEMAN->GetProfile(pn)->m_GoalType != m_GoalType ) return false; - if( !m_sProfileID.empty() && PREFSMAN->m_sDefaultLocalProfileID[pn].Get() != m_sProfileID ) + if( !m_sProfileID.empty() && ProfileManager::m_sDefaultLocalProfileID[pn].Get() != m_sProfileID ) return false; return true; @@ -834,7 +834,7 @@ void GameCommand::ApplySelf( const vector &vpns ) const PROFILEMAN->GetProfile(*pn)->m_GoalType = m_GoalType; if( !m_sProfileID.empty() ) FOREACH_CONST( PlayerNumber, vpns, pn ) - PREFSMAN->m_sDefaultLocalProfileID[*pn].Set( m_sProfileID ); + ProfileManager::m_sDefaultLocalProfileID[*pn].Set( m_sProfileID ); /* If we're going to stop music, do so before preparing new screens, so we don't * stop music between preparing screens and loading screens. */ diff --git a/stepmania/src/PrefsManager.cpp b/stepmania/src/PrefsManager.cpp index 72b390aa74..5cc93b5bff 100644 --- a/stepmania/src/PrefsManager.cpp +++ b/stepmania/src/PrefsManager.cpp @@ -208,12 +208,6 @@ void TimeMeterSecondsChangeInit( size_t /*ScoreEvent*/ i, CString &sNameOut, flo } } -void DefaultLocalProfileIDInit( size_t /*PlayerNumber*/ i, CString &sNameOut, CString &defaultValueOut ) -{ - sNameOut = "DefaultLocalProfileID" + PlayerNumberToString( (PlayerNumber)i ); - defaultValueOut = ""; -} - PrefsManager::PrefsManager() : m_sCurrentGame ( "CurrentGame", "" ), @@ -325,7 +319,6 @@ PrefsManager::PrefsManager() : m_sLanguage ( "Language", "" ), // ThemeManager will deal with this invalid language m_sMemoryCardProfileSubdir ( "MemoryCardProfileSubdir", PRODUCT_NAME ), m_iProductID ( "ProductID", 1 ), - m_sDefaultLocalProfileID ( DefaultLocalProfileIDInit, NUM_PLAYERS ), m_bMemoryCards ( "MemoryCards", false ), m_iCenterImageTranslateX ( "CenterImageTranslateX", 0 ), m_iCenterImageTranslateY ( "CenterImageTranslateY", 0 ), diff --git a/stepmania/src/PrefsManager.h b/stepmania/src/PrefsManager.h index 3ac6433b95..49a6ff0075 100644 --- a/stepmania/src/PrefsManager.h +++ b/stepmania/src/PrefsManager.h @@ -146,7 +146,6 @@ public: Preference m_sLanguage; Preference m_sMemoryCardProfileSubdir; // the directory on a memory card to look in for a profile Preference m_iProductID; // Saved in HighScore to track what software version a score came from. - Preference1D m_sDefaultLocalProfileID; Preference m_bMemoryCards; Preference m_iCenterImageTranslateX; Preference m_iCenterImageTranslateY; diff --git a/stepmania/src/ProfileManager.cpp b/stepmania/src/ProfileManager.cpp index 168943541b..42aed98a54 100644 --- a/stepmania/src/ProfileManager.cpp +++ b/stepmania/src/ProfileManager.cpp @@ -28,6 +28,14 @@ ProfileManager* PROFILEMAN = NULL; // global and accessable from anywhere in our program +static void DefaultLocalProfileIDInit( size_t /*PlayerNumber*/ i, CString &sNameOut, CString &defaultValueOut ) +{ + sNameOut = "DefaultLocalProfileID" + PlayerNumberToString( (PlayerNumber)i ); + defaultValueOut = ""; +} + +Preference1D ProfileManager::m_sDefaultLocalProfileID( DefaultLocalProfileIDInit, NUM_PLAYERS ); + #define NEW_MEM_CARD_NAME "" #define USER_PROFILES_DIR "/Data/LocalProfiles/" #define MACHINE_PROFILE_DIR "/Data/MachineProfile/" @@ -162,7 +170,7 @@ ProfileLoadResult ProfileManager::LoadProfile( PlayerNumber pn, CString sProfile bool ProfileManager::LoadLocalProfileFromMachine( PlayerNumber pn ) { - CString sProfileID = PREFSMAN->m_sDefaultLocalProfileID[pn]; + CString sProfileID = m_sDefaultLocalProfileID[pn]; if( sProfileID.empty() ) { m_sProfileDir[pn] = ""; diff --git a/stepmania/src/ProfileManager.h b/stepmania/src/ProfileManager.h index 9ca23dd8e5..cd657a87d3 100644 --- a/stepmania/src/ProfileManager.h +++ b/stepmania/src/ProfileManager.h @@ -6,6 +6,7 @@ #include "PlayerNumber.h" #include "GameConstantsAndTypes.h" #include "Difficulty.h" +#include "Preference.h" class Profile; class Song; @@ -111,6 +112,8 @@ public: // Lua void PushSelf( lua_State *L ); + static Preference1D m_sDefaultLocalProfileID; + private: ProfileLoadResult LoadProfile( PlayerNumber pn, CString sProfileDir, bool bIsMemCard ); void GetMemoryCardProfileDirectoriesToTry( vector &asDirsToTry ) const; diff --git a/stepmania/src/ScreenOptionsManageProfiles.cpp b/stepmania/src/ScreenOptionsManageProfiles.cpp index 8310cf1347..7bcc9a5151 100644 --- a/stepmania/src/ScreenOptionsManageProfiles.cpp +++ b/stepmania/src/ScreenOptionsManageProfiles.cpp @@ -281,13 +281,13 @@ void ScreenOptionsManageProfiles::HandleScreenMessage( const ScreenMessage SM ) PlayerNumber pn = (PlayerNumber)(ScreenMiniMenu::s_iLastRowCode - ProfileAction_SetDefaultP1); PlayerNumber pnOpposite = OPPOSITE_PLAYER[ pn ]; - PREFSMAN->m_sDefaultLocalProfileID[pn].Set( GetLocalProfileIDWithFocus() ); - if( PREFSMAN->m_sDefaultLocalProfileID[pn].Get() == PREFSMAN->m_sDefaultLocalProfileID[pnOpposite].Get() ) + ProfileManager::m_sDefaultLocalProfileID[pn].Set( GetLocalProfileIDWithFocus() ); + if( ProfileManager::m_sDefaultLocalProfileID[pn].Get() == ProfileManager::m_sDefaultLocalProfileID[pnOpposite].Get() ) { int iIndex = GetLocalProfileIndexWithFocus(); iIndex++; wrap( iIndex, m_vsLocalProfileID.size() ); - PREFSMAN->m_sDefaultLocalProfileID[pnOpposite].Set( m_vsLocalProfileID[iIndex] ); + ProfileManager::m_sDefaultLocalProfileID[pnOpposite].Set( m_vsLocalProfileID[iIndex] ); } } break; diff --git a/stepmania/src/ScreenSMOnlineLogin.cpp b/stepmania/src/ScreenSMOnlineLogin.cpp index 8f3073553d..0d1cbbca9a 100644 --- a/stepmania/src/ScreenSMOnlineLogin.cpp +++ b/stepmania/src/ScreenSMOnlineLogin.cpp @@ -66,7 +66,7 @@ void ScreenSMOnlineLogin::ImportOptions( int iRow, const vector &v FOREACH_PlayerNumber( pn ) { - CStringArray::iterator iter = find(vsProfiles.begin(), vsProfiles.end(), PREFSMAN->m_sDefaultLocalProfileID[pn].Get() ); + CStringArray::iterator iter = find(vsProfiles.begin(), vsProfiles.end(), ProfileManager::m_sDefaultLocalProfileID[pn].Get() ); if( iter != vsProfiles.end() ) m_pRows[0]->SetOneSelection((PlayerNumber) pn, iter - vsProfiles.begin()); } @@ -85,7 +85,7 @@ void ScreenSMOnlineLogin::ExportOptions( int iRow, const vector &v PROFILEMAN->GetLocalProfileIDs( vsProfiles ); FOREACH_EnabledPlayer( pn ) - PREFSMAN->m_sDefaultLocalProfileID[pn].Set( vsProfiles[m_pRows[0]->GetOneSelection(pn)] ); + ProfileManager::m_sDefaultLocalProfileID[pn].Set( vsProfiles[m_pRows[0]->GetOneSelection(pn)] ); } break; }