export specific rows, not all rows at once, to make it easier to reload certain rows

This commit is contained in:
Chris Danford
2005-02-24 01:17:39 +00:00
parent f395d0a401
commit 7c237be91f
13 changed files with 243 additions and 220 deletions
+9 -1
View File
@@ -29,8 +29,17 @@ OptionRow::OptionRow()
} }
OptionRow::~OptionRow() OptionRow::~OptionRow()
{
Clear();
}
void OptionRow::Clear()
{ {
ActorFrame::RemoveAllChildren(); ActorFrame::RemoveAllChildren();
FOREACH_PlayerNumber( p )
m_vbSelected[p].clear();
for( unsigned i = 0; i < m_textItems.size(); ++i ) for( unsigned i = 0; i < m_textItems.size(); ++i )
SAFE_DELETE( m_textItems[i] ); SAFE_DELETE( m_textItems[i] );
m_textItems.clear(); m_textItems.clear();
@@ -42,7 +51,6 @@ OptionRow::~OptionRow()
} }
} }
void OptionRow::LoadNormal( const OptionRowDefinition &def ) void OptionRow::LoadNormal( const OptionRowDefinition &def )
{ {
m_RowDef = def; m_RowDef = def;
+1
View File
@@ -80,6 +80,7 @@ public:
OptionRow(); OptionRow();
~OptionRow(); ~OptionRow();
void Clear();
void LoadNormal( const OptionRowDefinition &def ); void LoadNormal( const OptionRowDefinition &def );
void LoadExit( void LoadExit(
const CString &sFontPath, const CString &sFontPath,
+2 -2
View File
@@ -151,8 +151,8 @@ void ScreenNetworkOptions::MenuStart( PlayerNumber pn, const InputEventType type
#endif #endif
} }
void ScreenNetworkOptions::ImportOptions() { } void ScreenNetworkOptions::ImportOptions( int row ) { }
void ScreenNetworkOptions::ExportOptions() { } void ScreenNetworkOptions::ExportOptions( int row ) { }
void ScreenNetworkOptions::UpdateConnectStatus( ) void ScreenNetworkOptions::UpdateConnectStatus( )
{ {
+2 -2
View File
@@ -14,8 +14,8 @@ public:
virtual void MenuStart( PlayerNumber pn, const InputEventType type ); virtual void MenuStart( PlayerNumber pn, const InputEventType type );
private: private:
void ImportOptions(); void ImportOptions( int row );
void ExportOptions(); void ExportOptions( int row );
void GoToNextScreen(); void GoToNextScreen();
void GoToPrevScreen(); void GoToPrevScreen();
+35 -48
View File
@@ -158,20 +158,16 @@ void ScreenOptions::InitMenu( InputMode im, OptionRowDefinition defs[], int iNum
m_bShowUnderlines = bShowUnderlines; m_bShowUnderlines = bShowUnderlines;
for( int r=0; r<iNumOptionLines; r++ ) // foreach row
{
m_Rows.push_back( new OptionRow() );
OptionRow &row = *m_Rows.back();
row.LoadNormal( defs[r] );
}
this->ImportOptions();
Font* pFont = FONT->LoadFont( THEME->GetPathF(m_sName,"item") ); Font* pFont = FONT->LoadFont( THEME->GetPathF(m_sName,"item") );
for( int r=0; r<iNumOptionLines; r++ ) // foreach row for( int r=0; r<iNumOptionLines; r++ ) // foreach row
{ {
OptionRow &row = *m_Rows[r]; m_Rows.push_back( new OptionRow() );
OptionRow &row = *m_Rows.back();
row.LoadNormal( defs[r] );
this->ImportOptions( r );
CHECKPOINT_M( ssprintf("row %i: %s", r, row.GetRowDef().name.c_str()) ); CHECKPOINT_M( ssprintf("row %i: %s", r, row.GetRowDef().name.c_str()) );
@@ -574,7 +570,8 @@ void ScreenOptions::HandleScreenMessage( const ScreenMessage SM )
this->GoToPrevScreen(); this->GoToPrevScreen();
break; break;
case SM_GoToNextScreen: case SM_GoToNextScreen:
this->ExportOptions(); for( unsigned r=0; r<m_Rows.size(); r++ ) // foreach row
this->ExportOptions(r);
this->GoToNextScreen(); this->GoToNextScreen();
break; break;
case SM_BeginFadingOut: case SM_BeginFadingOut:
@@ -1144,41 +1141,35 @@ void ScreenOptions::RefreshRowChoices( int r, const OptionRowDefinition &newdef
{ {
OptionRow &row = *m_Rows[r]; OptionRow &row = *m_Rows[r];
// For now, update only m_vEnabledForPlayers switch( row.GetRowType() )
row.GetRowDef().m_vEnabledForPlayers = newdef.m_vEnabledForPlayers;
UpdateEnabledDisabled( r );
/*
Font* pFont = FONT->LoadFont( THEME->GetPathF(m_sName,"item") );
OptionRow &row = *m_Rows[r];
OptionRow::RowType rt = row.GetRowType();
row.Clear();
switch( rt )
{ {
case OptionRow::ROW_NORMAL: case OptionRow::ROW_NORMAL:
row.LoadNormal( def ); {
row.AfterImportOptions( Font* pFont = FONT->LoadFont( THEME->GetPathF(m_sName,"item") );
pFont, row.Clear();
ITEMS_START_X, row.LoadNormal( newdef );
ITEMS_GAP_X, row.AfterImportOptions(
ITEMS_END_X, pFont,
ITEMS_LONG_ROW_SHARED_X, ITEMS_START_X,
ITEMS_LONG_ROW_X, ITEMS_GAP_X,
ITEMS_ZOOM, ITEMS_END_X,
CAPITALIZE_ALL_OPTION_NAMES, ITEMS_LONG_ROW_SHARED_X,
THEME->GetPathF(m_sName,"item"), ITEMS_LONG_ROW_X,
THEME->GetPathF(m_sName,"title"), ITEMS_ZOOM,
GetExplanationTitle( r ), CAPITALIZE_ALL_OPTION_NAMES,
THEME->GetPathG(m_sName,"bullet"), THEME->GetPathF(m_sName,"item"),
LABELS_X, THEME->GetPathF(m_sName,"title"),
ARROWS_X, GetExplanationTitle( r ),
row.GetRowY(), THEME->GetPathG(m_sName,"bullet"),
LABELS_ON_COMMAND LABELS_X,
); ARROWS_X,
row.GetRowY(),
LABELS_ON_COMMAND
);
FONT->UnloadFont( pFont );
pFont = NULL;
UpdateEnabledDisabled( r );
}
break; break;
case OptionRow::ROW_EXIT: case OptionRow::ROW_EXIT:
// nothing to do // nothing to do
@@ -1186,10 +1177,6 @@ void ScreenOptions::RefreshRowChoices( int r, const OptionRowDefinition &newdef
default: default:
ASSERT(0); ASSERT(0);
} }
FONT->UnloadFont( pFont );
pFont = NULL;
*/
} }
/* /*
+2 -2
View File
@@ -31,8 +31,8 @@ public:
virtual void HandleScreenMessage( const ScreenMessage SM ); virtual void HandleScreenMessage( const ScreenMessage SM );
protected: protected:
virtual void ImportOptions() = 0; virtual void ImportOptions( int row ) = 0;
virtual void ExportOptions() = 0; virtual void ExportOptions( int row ) = 0;
void InitOptionsText(); void InitOptionsText();
void GetWidthXY( PlayerNumber pn, int iRow, int iChoiceOnRow, int &iWidthOut, int &iXOut, int &iYOut ); void GetWidthXY( PlayerNumber pn, int iRow, int iChoiceOnRow, int &iWidthOut, int &iXOut, int &iYOut );
CString GetExplanationText( int row ) const; CString GetExplanationText( int row ) const;
+113 -106
View File
@@ -723,25 +723,20 @@ void ScreenOptionsMaster::ImportOption( const OptionRowDefinition &row, const Op
} }
} }
void ScreenOptionsMaster::ImportOptions() void ScreenOptionsMaster::ImportOptions( int r )
{ {
for( unsigned i = 0; i < OptionRowHandlers.size(); ++i ) const OptionRowHandler &hand = OptionRowHandlers[r];
{ const OptionRowDefinition &def = m_OptionRowAlloc[r];
const OptionRowHandler &hand = OptionRowHandlers[i]; OptionRow &row = *m_Rows[r];
const OptionRowDefinition &def = m_OptionRowAlloc[i];
OptionRow &row = *m_Rows[i];
if( def.bOneChoiceForAllPlayers ) if( def.bOneChoiceForAllPlayers )
{ {
ImportOption(def, hand, PLAYER_1, i, row.m_vbSelected[0] ); ImportOption(def, hand, PLAYER_1, r, row.m_vbSelected[0] );
} }
else else
{ {
FOREACH_HumanPlayer( p ) FOREACH_HumanPlayer( p )
{ ImportOption( def, hand, p, r, row.m_vbSelected[p] );
ImportOption( def, hand, p, i, row.m_vbSelected[p] );
}
}
} }
} }
@@ -862,9 +857,8 @@ int ScreenOptionsMaster::ExportOption( const OptionRowDefinition &row, const Opt
return 0; return 0;
} }
int ScreenOptionsMaster::ExportOptionForAllPlayers( int iRow ) void ScreenOptionsMaster::ExportOptions( int iRow )
{ {
int iChangeMask = 0;
const OptionRowHandler &hand = OptionRowHandlers[iRow]; const OptionRowHandler &hand = OptionRowHandlers[iRow];
const OptionRowDefinition &def = m_OptionRowAlloc[iRow]; const OptionRowDefinition &def = m_OptionRowAlloc[iRow];
OptionRow &row = *m_Rows[iRow]; OptionRow &row = *m_Rows[iRow];
@@ -872,93 +866,8 @@ int ScreenOptionsMaster::ExportOptionForAllPlayers( int iRow )
{ {
vector<bool> &vbSelected = row.m_vbSelected[pn]; vector<bool> &vbSelected = row.m_vbSelected[pn];
iChangeMask |= ExportOption( def, hand, pn, vbSelected ); m_iChangeMask |= ExportOption( def, hand, pn, vbSelected );
} }
return iChangeMask;
}
void ScreenOptionsMaster::ExportOptions()
{
int ChangeMask = 0;
CHECKPOINT;
const unsigned row = this->GetCurrentRow();
/* If the selection is on a LIST, and the selected LIST option sets the screen,
* honor it. */
m_sNextScreen = "";
for( unsigned i = 0; i < OptionRowHandlers.size(); ++i )
{
CHECKPOINT_M( ssprintf("%i/%i", i, int(OptionRowHandlers.size())) );
/* If SELECT_NONE, only apply it if it's the selected option. */
const OptionRowDefinition &def = m_OptionRowAlloc[i];
if( def.selectType == SELECT_NONE && i != row )
continue;
OptionRowHandler &hand = OptionRowHandlers[i];
if( hand.type == ROW_LIST )
{
const int choice = m_Rows[i]->m_iChoiceInRowWithFocus[GAMESTATE->m_MasterPlayerNumber];
GameCommand &mc = hand.ListEntries[choice];
if( mc.m_sScreen != "" )
{
/* Hack: instead of applying screen commands here, store them in
* m_sNextScreen and apply them after we tween out. If we don't set
* m_sScreen to "", we'll load it twice (once for each player) and
* then again for m_sNextScreen. */
m_sNextScreen = mc.m_sScreen;
mc.m_sScreen = "";
}
}
ExportOptionForAllPlayers( i );
}
CHECKPOINT;
// NEXT_SCREEN;
if( m_sNextScreen == "" )
m_sNextScreen = NEXT_SCREEN;
if( ChangeMask & OPT_APPLY_ASPECT_RATIO )
{
THEME->UpdateLuaGlobals(); // This needs to be done before resetting the projection matrix below
SCREENMAN->ThemeChanged(); // recreate ScreenSystemLayer and SharedBGA
}
/* If the theme changes, we need to reset RageDisplay to apply new theme
* window title and icon. */
/* If the aspect ratio changes, we need to reset RageDisplay so that the
* projection matrix is re-created using the new screen dimensions. */
if( (ChangeMask & OPT_APPLY_THEME) ||
(ChangeMask & OPT_APPLY_GRAPHICS) ||
(ChangeMask & OPT_APPLY_ASPECT_RATIO) )
ApplyGraphicOptions();
if( ChangeMask & OPT_SAVE_PREFERENCES )
{
/* Save preferences. */
LOG->Trace("ROW_CONFIG used; saving ...");
PREFSMAN->SaveGlobalPrefsToDisk();
SaveGamePrefsToDisk();
}
if( ChangeMask & OPT_RESET_GAME )
{
ResetGame();
m_sNextScreen = "";
}
if( ChangeMask & OPT_APPLY_SOUND )
{
SOUNDMAN->SetPrefs( PREFSMAN->m_fSoundVolume );
}
if( ChangeMask & OPT_APPLY_SONG )
SONGMAN->SetPreferences();
CHECKPOINT;
} }
void ScreenOptionsMaster::GoToNextScreen() void ScreenOptionsMaster::GoToNextScreen()
@@ -1040,7 +949,7 @@ void ScreenOptionsMaster::ChangeValueInRow( PlayerNumber pn, int iDelta, bool Re
const OptionRowHandler &hand = OptionRowHandlers[iRow]; const OptionRowHandler &hand = OptionRowHandlers[iRow];
if( hand.m_bExportOnChange || !hand.m_vsRefreshRowNames.empty() ) if( hand.m_bExportOnChange || !hand.m_vsRefreshRowNames.empty() )
ExportOptionForAllPlayers( iRow ); ExportOptions( iRow );
FOREACH_CONST( CString, hand.m_vsRefreshRowNames, sRowToRefreshName ) FOREACH_CONST( CString, hand.m_vsRefreshRowNames, sRowToRefreshName )
{ {
@@ -1071,6 +980,104 @@ void ScreenOptionsMaster::ChangeValueInRow( PlayerNumber pn, int iDelta, bool Re
} }
} }
void ScreenOptionsMaster::HandleScreenMessage( const ScreenMessage SM )
{
switch( SM )
{
case SM_GoToNextScreen:
{
//
// Override ScreenOptions's calling of ExportOptions
//
m_iChangeMask = 0;
CHECKPOINT;
const unsigned uFocusRow = this->GetCurrentRow();
/* If the selection is on a LIST, and the selected LIST option sets the screen,
* honor it. */
m_sNextScreen = "";
for( unsigned i = 0; i < OptionRowHandlers.size(); ++i )
{
CHECKPOINT_M( ssprintf("%i/%i", i, int(OptionRowHandlers.size())) );
/* If SELECT_NONE, only apply it if it's the selected option. */
const OptionRowDefinition &def = m_OptionRowAlloc[i];
if( def.selectType == SELECT_NONE && i != uFocusRow )
continue;
OptionRowHandler &hand = OptionRowHandlers[i];
if( hand.type == ROW_LIST )
{
const int choice = m_Rows[i]->m_iChoiceInRowWithFocus[GAMESTATE->m_MasterPlayerNumber];
GameCommand &mc = hand.ListEntries[choice];
if( mc.m_sScreen != "" )
{
/* Hack: instead of applying screen commands here, store them in
* m_sNextScreen and apply them after we tween out. If we don't set
* m_sScreen to "", we'll load it twice (once for each player) and
* then again for m_sNextScreen. */
m_sNextScreen = mc.m_sScreen;
mc.m_sScreen = "";
}
}
ExportOptions( i );
}
CHECKPOINT;
// NEXT_SCREEN;
if( m_sNextScreen == "" )
m_sNextScreen = NEXT_SCREEN;
if( m_iChangeMask & OPT_APPLY_ASPECT_RATIO )
{
THEME->UpdateLuaGlobals(); // This needs to be done before resetting the projection matrix below
SCREENMAN->ThemeChanged(); // recreate ScreenSystemLayer and SharedBGA
}
/* If the theme changes, we need to reset RageDisplay to apply new theme
* window title and icon. */
/* If the aspect ratio changes, we need to reset RageDisplay so that the
* projection matrix is re-created using the new screen dimensions. */
if( (m_iChangeMask & OPT_APPLY_THEME) ||
(m_iChangeMask & OPT_APPLY_GRAPHICS) ||
(m_iChangeMask & OPT_APPLY_ASPECT_RATIO) )
ApplyGraphicOptions();
if( m_iChangeMask & OPT_SAVE_PREFERENCES )
{
/* Save preferences. */
LOG->Trace("ROW_CONFIG used; saving ...");
PREFSMAN->SaveGlobalPrefsToDisk();
SaveGamePrefsToDisk();
}
if( m_iChangeMask & OPT_RESET_GAME )
{
ResetGame();
m_sNextScreen = "";
}
if( m_iChangeMask & OPT_APPLY_SOUND )
{
SOUNDMAN->SetPrefs( PREFSMAN->m_fSoundVolume );
}
if( m_iChangeMask & OPT_APPLY_SONG )
SONGMAN->SetPreferences();
CHECKPOINT;
this->GoToNextScreen();
}
break;
default:
ScreenOptions::HandleScreenMessage( SM );
break;
}
}
/* /*
* (c) 2003-2004 Glenn Maynard * (c) 2003-2004 Glenn Maynard
+6 -4
View File
@@ -23,7 +23,7 @@ public:
virtual ~ScreenOptionsMaster(); virtual ~ScreenOptionsMaster();
void Update( float fDelta ); void Update( float fDelta );
private: protected:
struct OptionRowHandler struct OptionRowHandler
{ {
@@ -58,6 +58,7 @@ private:
const ConfOption *opt; const ConfOption *opt;
}; };
int m_iChangeMask;
CString m_sNextScreen; CString m_sNextScreen;
vector<OptionRowHandler> OptionRowHandlers; vector<OptionRowHandler> OptionRowHandlers;
@@ -65,7 +66,6 @@ private:
int ExportOption( const OptionRowDefinition &def, const OptionRowHandler &hand, PlayerNumber pn, const vector<bool> &vbSelected ); int ExportOption( const OptionRowDefinition &def, const OptionRowHandler &hand, PlayerNumber pn, const vector<bool> &vbSelected );
void ImportOption( const OptionRowDefinition &def, const OptionRowHandler &hand, PlayerNumber pn, int rowno, vector<bool> &vbSelectedOut ); void ImportOption( const OptionRowDefinition &def, const OptionRowHandler &hand, PlayerNumber pn, int rowno, vector<bool> &vbSelectedOut );
int ExportOptionForAllPlayers( int iRow );
static void SetList( OptionRowDefinition &def, OptionRowHandler &hand, CString param ); static void SetList( OptionRowDefinition &def, OptionRowHandler &hand, CString param );
static void SetLua( OptionRowDefinition &def, OptionRowHandler &hand, const CString &sLuaFunction ); static void SetLua( OptionRowDefinition &def, OptionRowHandler &hand, const CString &sLuaFunction );
@@ -77,10 +77,12 @@ private:
static void SetDifficulties( OptionRowDefinition &def, OptionRowHandler &hand ); static void SetDifficulties( OptionRowDefinition &def, OptionRowHandler &hand );
protected: protected:
void HandleScreenMessage( const ScreenMessage SM );
virtual void ChangeValueInRow( PlayerNumber pn, int iDelta, bool Repeat ); virtual void ChangeValueInRow( PlayerNumber pn, int iDelta, bool Repeat );
virtual void ImportOptions(); virtual void ImportOptions( int row );
virtual void ExportOptions(); virtual void ExportOptions( int row );
virtual void ImportOptionsForPlayer( PlayerNumber pn ); // used by ScreenPlayerOptions virtual void ImportOptionsForPlayer( PlayerNumber pn ); // used by ScreenPlayerOptions
virtual void GoToNextScreen(); virtual void GoToNextScreen();
+3 -4
View File
@@ -185,15 +185,14 @@ void ScreenPlayerOptions::HandleScreenMessage( const ScreenMessage SM )
void ScreenPlayerOptions::UpdateDisqualified() void ScreenPlayerOptions::UpdateDisqualified()
{ {
// save current player options // save current player options
PlayerOptions po[2]; PlayerOptions po[NUM_PLAYERS];
FOREACH_PlayerNumber( p ) FOREACH_PlayerNumber( p )
{
po[p] = GAMESTATE->m_pPlayerState[p]->m_PlayerOptions; po[p] = GAMESTATE->m_pPlayerState[p]->m_PlayerOptions;
}
// export the currently selection options, which will fill GAMESTATE->m_PlayerOptions // export the currently selection options, which will fill GAMESTATE->m_PlayerOptions
ScreenOptionsMaster::ExportOptions(); for( unsigned r=0; r<OptionRowHandlers.size(); r++ )
ScreenOptionsMaster::ExportOptions( r );
FOREACH_HumanPlayer( p ) FOREACH_HumanPlayer( p )
{ {
+34 -30
View File
@@ -80,42 +80,46 @@ void ScreenProfileOptions::Init()
SOUND->PlayMusic( THEME->GetPathS("ScreenMachineOptions","music") ); SOUND->PlayMusic( THEME->GetPathS("ScreenMachineOptions","music") );
} }
void ScreenProfileOptions::ImportOptions() void ScreenProfileOptions::ImportOptions( int row )
{ {
vector<CString> vsProfiles; switch( row )
PROFILEMAN->GetLocalProfileIDs( vsProfiles ); {
case PO_PLAYER1:
case PO_PLAYER2:
{
PlayerNumber pn = (PlayerNumber)(row - PO_PLAYER1);
vector<CString> vsProfiles;
PROFILEMAN->GetLocalProfileIDs( vsProfiles );
CStringArray::iterator iter; CStringArray::iterator iter = find(
vsProfiles.begin(),
iter = find( vsProfiles.end(),
vsProfiles.begin(), PREFSMAN->m_sDefaultLocalProfileID[pn] );
vsProfiles.end(), if( iter != vsProfiles.end() )
PREFSMAN->m_sDefaultLocalProfileID[PLAYER_1] ); m_Rows[row]->SetOneSharedSelection( iter - vsProfiles.begin() + 1 );
if( iter != vsProfiles.end() ) }
m_Rows[PO_PLAYER1]->SetOneSharedSelection( iter - vsProfiles.begin() + 1 ); break;
}
iter = find(
vsProfiles.begin(),
vsProfiles.end(),
PREFSMAN->m_sDefaultLocalProfileID[PLAYER_2] );
if( iter != vsProfiles.end() )
m_Rows[PO_PLAYER2]->SetOneSharedSelection( iter - vsProfiles.begin() + 1 );
} }
void ScreenProfileOptions::ExportOptions() void ScreenProfileOptions::ExportOptions( int row )
{ {
vector<CString> vsProfiles; switch( row )
PROFILEMAN->GetLocalProfileIDs( vsProfiles ); {
case PO_PLAYER1:
case PO_PLAYER2:
{
PlayerNumber pn = (PlayerNumber)(row - PO_PLAYER1);
vector<CString> vsProfiles;
PROFILEMAN->GetLocalProfileIDs( vsProfiles );
if( m_Rows[PO_PLAYER1]->GetOneSharedSelection() > 0 ) if( m_Rows[row]->GetOneSharedSelection() > 0 )
PREFSMAN->m_sDefaultLocalProfileID[PLAYER_1] = vsProfiles[m_Rows[PO_PLAYER1]->GetOneSharedSelection()-1]; PREFSMAN->m_sDefaultLocalProfileID[pn] = vsProfiles[m_Rows[row]->GetOneSharedSelection()-1];
else else
PREFSMAN->m_sDefaultLocalProfileID[PLAYER_1] = ""; PREFSMAN->m_sDefaultLocalProfileID[pn] = "";
}
if( m_Rows[PO_PLAYER2]->GetOneSharedSelection() > 0 ) break;
PREFSMAN->m_sDefaultLocalProfileID[PLAYER_2] = vsProfiles[m_Rows[PO_PLAYER2]->GetOneSharedSelection()-1]; }
else
PREFSMAN->m_sDefaultLocalProfileID[PLAYER_2] = "";
} }
void ScreenProfileOptions::GoToPrevScreen() void ScreenProfileOptions::GoToPrevScreen()
+2 -2
View File
@@ -14,8 +14,8 @@ public:
virtual void MenuStart( PlayerNumber pn, const InputEventType type ); virtual void MenuStart( PlayerNumber pn, const InputEventType type );
private: private:
void ImportOptions(); void ImportOptions( int row );
void ExportOptions(); void ExportOptions( int row );
void GoToNextScreen(); void GoToNextScreen();
void GoToPrevScreen(); void GoToPrevScreen();
+32 -17
View File
@@ -51,29 +51,43 @@ void ScreenSMOnlineLogin::Init()
} }
} }
void ScreenSMOnlineLogin::ImportOptions() void ScreenSMOnlineLogin::ImportOptions( int row )
{ {
vector<CString> vsProfiles; switch( row )
PROFILEMAN->GetLocalProfileIDs( vsProfiles );
CStringArray::iterator iter;
FOREACH_PlayerNumber( pn )
{ {
iter = find(vsProfiles.begin(), vsProfiles.end(), PREFSMAN->m_sDefaultLocalProfileID[pn] ); case 0:
if( iter != vsProfiles.end() ) {
m_Rows[0]->SetOneSelection((PlayerNumber) pn, iter - vsProfiles.begin()); vector<CString> vsProfiles;
PROFILEMAN->GetLocalProfileIDs( vsProfiles );
CStringArray::iterator iter;
FOREACH_PlayerNumber( pn )
{
iter = find(vsProfiles.begin(), vsProfiles.end(), PREFSMAN->m_sDefaultLocalProfileID[pn] );
if( iter != vsProfiles.end() )
m_Rows[0]->SetOneSelection((PlayerNumber) pn, iter - vsProfiles.begin());
}
}
break;
} }
} }
void ScreenSMOnlineLogin::ExportOptions() void ScreenSMOnlineLogin::ExportOptions( int row )
{ {
vector<CString> vsProfiles; switch( row )
PROFILEMAN->GetLocalProfileIDs( vsProfiles );
FOREACH_EnabledPlayer( pn )
{ {
PREFSMAN->m_sDefaultLocalProfileID[pn] = vsProfiles[m_Rows[0]->GetOneSelection((PlayerNumber) pn)]; case 0:
{
vector<CString> vsProfiles;
PROFILEMAN->GetLocalProfileIDs( vsProfiles );
FOREACH_EnabledPlayer( pn )
{
PREFSMAN->m_sDefaultLocalProfileID[pn] = vsProfiles[m_Rows[0]->GetOneSelection((PlayerNumber) pn)];
}
}
break;
} }
} }
@@ -84,7 +98,8 @@ void ScreenSMOnlineLogin::GoToPrevScreen()
void ScreenSMOnlineLogin::GoToNextScreen() void ScreenSMOnlineLogin::GoToNextScreen()
{ {
ExportOptions(); for( unsigned r=0; r<m_Rows.size(); r++ )
ExportOptions( r );
PREFSMAN->SaveGlobalPrefsToDisk(); PREFSMAN->SaveGlobalPrefsToDisk();
FOREACH_EnabledPlayer(pn) FOREACH_EnabledPlayer(pn)
{ {
+2 -2
View File
@@ -13,8 +13,8 @@ public:
void SendLogin(CString sPassword); void SendLogin(CString sPassword);
private: private:
void ImportOptions(); void ImportOptions( int row );
void ExportOptions(); void ExportOptions( int row );
void GoToNextScreen(); void GoToNextScreen();
void GoToPrevScreen(); void GoToPrevScreen();
CString GetSelectedProfileID(); CString GetSelectedProfileID();