move m_sDefaultLocalProfileID into ProfileManager

This commit is contained in:
Glenn Maynard
2005-10-27 17:47:42 +00:00
parent a9038f82dd
commit 4c62c63e84
7 changed files with 19 additions and 16 deletions
+2 -2
View File
@@ -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<PlayerNumber> &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. */
-7
View File
@@ -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 ),
-1
View File
@@ -146,7 +146,6 @@ public:
Preference<CString> m_sLanguage;
Preference<CString> m_sMemoryCardProfileSubdir; // the directory on a memory card to look in for a profile
Preference<int> m_iProductID; // Saved in HighScore to track what software version a score came from.
Preference1D<CString> m_sDefaultLocalProfileID;
Preference<bool> m_bMemoryCards;
Preference<int> m_iCenterImageTranslateX;
Preference<int> m_iCenterImageTranslateY;
+9 -1
View File
@@ -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<CString> 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] = "";
+3
View File
@@ -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<CString> m_sDefaultLocalProfileID;
private:
ProfileLoadResult LoadProfile( PlayerNumber pn, CString sProfileDir, bool bIsMemCard );
void GetMemoryCardProfileDirectoriesToTry( vector<CString> &asDirsToTry ) const;
@@ -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;
+2 -2
View File
@@ -66,7 +66,7 @@ void ScreenSMOnlineLogin::ImportOptions( int iRow, const vector<PlayerNumber> &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<PlayerNumber> &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;
}