move m_sDefaultLocalProfileID into ProfileManager
This commit is contained in:
@@ -139,7 +139,7 @@ bool GameCommand::DescribesCurrentMode( PlayerNumber pn ) const
|
|||||||
return false;
|
return false;
|
||||||
if( m_GoalType != GOAL_INVALID && PROFILEMAN->GetProfile(pn)->m_GoalType != m_GoalType )
|
if( m_GoalType != GOAL_INVALID && PROFILEMAN->GetProfile(pn)->m_GoalType != m_GoalType )
|
||||||
return false;
|
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 false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -834,7 +834,7 @@ void GameCommand::ApplySelf( const vector<PlayerNumber> &vpns ) const
|
|||||||
PROFILEMAN->GetProfile(*pn)->m_GoalType = m_GoalType;
|
PROFILEMAN->GetProfile(*pn)->m_GoalType = m_GoalType;
|
||||||
if( !m_sProfileID.empty() )
|
if( !m_sProfileID.empty() )
|
||||||
FOREACH_CONST( PlayerNumber, vpns, pn )
|
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
|
/* 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. */
|
* stop music between preparing screens and loading screens. */
|
||||||
|
|||||||
@@ -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() :
|
PrefsManager::PrefsManager() :
|
||||||
m_sCurrentGame ( "CurrentGame", "" ),
|
m_sCurrentGame ( "CurrentGame", "" ),
|
||||||
@@ -325,7 +319,6 @@ PrefsManager::PrefsManager() :
|
|||||||
m_sLanguage ( "Language", "" ), // ThemeManager will deal with this invalid language
|
m_sLanguage ( "Language", "" ), // ThemeManager will deal with this invalid language
|
||||||
m_sMemoryCardProfileSubdir ( "MemoryCardProfileSubdir", PRODUCT_NAME ),
|
m_sMemoryCardProfileSubdir ( "MemoryCardProfileSubdir", PRODUCT_NAME ),
|
||||||
m_iProductID ( "ProductID", 1 ),
|
m_iProductID ( "ProductID", 1 ),
|
||||||
m_sDefaultLocalProfileID ( DefaultLocalProfileIDInit, NUM_PLAYERS ),
|
|
||||||
m_bMemoryCards ( "MemoryCards", false ),
|
m_bMemoryCards ( "MemoryCards", false ),
|
||||||
m_iCenterImageTranslateX ( "CenterImageTranslateX", 0 ),
|
m_iCenterImageTranslateX ( "CenterImageTranslateX", 0 ),
|
||||||
m_iCenterImageTranslateY ( "CenterImageTranslateY", 0 ),
|
m_iCenterImageTranslateY ( "CenterImageTranslateY", 0 ),
|
||||||
|
|||||||
@@ -146,7 +146,6 @@ public:
|
|||||||
Preference<CString> m_sLanguage;
|
Preference<CString> m_sLanguage;
|
||||||
Preference<CString> m_sMemoryCardProfileSubdir; // the directory on a memory card to look in for a profile
|
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.
|
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<bool> m_bMemoryCards;
|
||||||
Preference<int> m_iCenterImageTranslateX;
|
Preference<int> m_iCenterImageTranslateX;
|
||||||
Preference<int> m_iCenterImageTranslateY;
|
Preference<int> m_iCenterImageTranslateY;
|
||||||
|
|||||||
@@ -28,6 +28,14 @@
|
|||||||
|
|
||||||
ProfileManager* PROFILEMAN = NULL; // global and accessable from anywhere in our program
|
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 NEW_MEM_CARD_NAME ""
|
||||||
#define USER_PROFILES_DIR "/Data/LocalProfiles/"
|
#define USER_PROFILES_DIR "/Data/LocalProfiles/"
|
||||||
#define MACHINE_PROFILE_DIR "/Data/MachineProfile/"
|
#define MACHINE_PROFILE_DIR "/Data/MachineProfile/"
|
||||||
@@ -162,7 +170,7 @@ ProfileLoadResult ProfileManager::LoadProfile( PlayerNumber pn, CString sProfile
|
|||||||
|
|
||||||
bool ProfileManager::LoadLocalProfileFromMachine( PlayerNumber pn )
|
bool ProfileManager::LoadLocalProfileFromMachine( PlayerNumber pn )
|
||||||
{
|
{
|
||||||
CString sProfileID = PREFSMAN->m_sDefaultLocalProfileID[pn];
|
CString sProfileID = m_sDefaultLocalProfileID[pn];
|
||||||
if( sProfileID.empty() )
|
if( sProfileID.empty() )
|
||||||
{
|
{
|
||||||
m_sProfileDir[pn] = "";
|
m_sProfileDir[pn] = "";
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
#include "PlayerNumber.h"
|
#include "PlayerNumber.h"
|
||||||
#include "GameConstantsAndTypes.h"
|
#include "GameConstantsAndTypes.h"
|
||||||
#include "Difficulty.h"
|
#include "Difficulty.h"
|
||||||
|
#include "Preference.h"
|
||||||
|
|
||||||
class Profile;
|
class Profile;
|
||||||
class Song;
|
class Song;
|
||||||
@@ -111,6 +112,8 @@ public:
|
|||||||
// Lua
|
// Lua
|
||||||
void PushSelf( lua_State *L );
|
void PushSelf( lua_State *L );
|
||||||
|
|
||||||
|
static Preference1D<CString> m_sDefaultLocalProfileID;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ProfileLoadResult LoadProfile( PlayerNumber pn, CString sProfileDir, bool bIsMemCard );
|
ProfileLoadResult LoadProfile( PlayerNumber pn, CString sProfileDir, bool bIsMemCard );
|
||||||
void GetMemoryCardProfileDirectoriesToTry( vector<CString> &asDirsToTry ) const;
|
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 pn = (PlayerNumber)(ScreenMiniMenu::s_iLastRowCode - ProfileAction_SetDefaultP1);
|
||||||
PlayerNumber pnOpposite = OPPOSITE_PLAYER[ pn ];
|
PlayerNumber pnOpposite = OPPOSITE_PLAYER[ pn ];
|
||||||
|
|
||||||
PREFSMAN->m_sDefaultLocalProfileID[pn].Set( GetLocalProfileIDWithFocus() );
|
ProfileManager::m_sDefaultLocalProfileID[pn].Set( GetLocalProfileIDWithFocus() );
|
||||||
if( PREFSMAN->m_sDefaultLocalProfileID[pn].Get() == PREFSMAN->m_sDefaultLocalProfileID[pnOpposite].Get() )
|
if( ProfileManager::m_sDefaultLocalProfileID[pn].Get() == ProfileManager::m_sDefaultLocalProfileID[pnOpposite].Get() )
|
||||||
{
|
{
|
||||||
int iIndex = GetLocalProfileIndexWithFocus();
|
int iIndex = GetLocalProfileIndexWithFocus();
|
||||||
iIndex++;
|
iIndex++;
|
||||||
wrap( iIndex, m_vsLocalProfileID.size() );
|
wrap( iIndex, m_vsLocalProfileID.size() );
|
||||||
PREFSMAN->m_sDefaultLocalProfileID[pnOpposite].Set( m_vsLocalProfileID[iIndex] );
|
ProfileManager::m_sDefaultLocalProfileID[pnOpposite].Set( m_vsLocalProfileID[iIndex] );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ void ScreenSMOnlineLogin::ImportOptions( int iRow, const vector<PlayerNumber> &v
|
|||||||
|
|
||||||
FOREACH_PlayerNumber( pn )
|
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() )
|
if( iter != vsProfiles.end() )
|
||||||
m_pRows[0]->SetOneSelection((PlayerNumber) pn, iter - vsProfiles.begin());
|
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 );
|
PROFILEMAN->GetLocalProfileIDs( vsProfiles );
|
||||||
|
|
||||||
FOREACH_EnabledPlayer( pn )
|
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;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user