From 7c237be91f5cf7590a934539d605d018e8aba389 Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Thu, 24 Feb 2005 01:17:39 +0000 Subject: [PATCH] export specific rows, not all rows at once, to make it easier to reload certain rows --- stepmania/src/OptionRow.cpp | 10 +- stepmania/src/OptionRow.h | 1 + stepmania/src/ScreenNetworkOptions.cpp | 4 +- stepmania/src/ScreenNetworkOptions.h | 4 +- stepmania/src/ScreenOptions.cpp | 83 ++++------ stepmania/src/ScreenOptions.h | 4 +- stepmania/src/ScreenOptionsMaster.cpp | 219 +++++++++++++------------ stepmania/src/ScreenOptionsMaster.h | 10 +- stepmania/src/ScreenPlayerOptions.cpp | 7 +- stepmania/src/ScreenProfileOptions.cpp | 64 ++++---- stepmania/src/ScreenProfileOptions.h | 4 +- stepmania/src/ScreenSMOnlineLogin.cpp | 49 ++++-- stepmania/src/ScreenSMOnlineLogin.h | 4 +- 13 files changed, 243 insertions(+), 220 deletions(-) diff --git a/stepmania/src/OptionRow.cpp b/stepmania/src/OptionRow.cpp index 26e13454d2..40b211ebcc 100644 --- a/stepmania/src/OptionRow.cpp +++ b/stepmania/src/OptionRow.cpp @@ -29,8 +29,17 @@ OptionRow::OptionRow() } OptionRow::~OptionRow() +{ + Clear(); +} + +void OptionRow::Clear() { ActorFrame::RemoveAllChildren(); + + FOREACH_PlayerNumber( p ) + m_vbSelected[p].clear(); + for( unsigned i = 0; i < m_textItems.size(); ++i ) SAFE_DELETE( m_textItems[i] ); m_textItems.clear(); @@ -42,7 +51,6 @@ OptionRow::~OptionRow() } } - void OptionRow::LoadNormal( const OptionRowDefinition &def ) { m_RowDef = def; diff --git a/stepmania/src/OptionRow.h b/stepmania/src/OptionRow.h index 4462f40ae3..c3583a807c 100644 --- a/stepmania/src/OptionRow.h +++ b/stepmania/src/OptionRow.h @@ -80,6 +80,7 @@ public: OptionRow(); ~OptionRow(); + void Clear(); void LoadNormal( const OptionRowDefinition &def ); void LoadExit( const CString &sFontPath, diff --git a/stepmania/src/ScreenNetworkOptions.cpp b/stepmania/src/ScreenNetworkOptions.cpp index 88c58c8fa0..8ff3f5c664 100644 --- a/stepmania/src/ScreenNetworkOptions.cpp +++ b/stepmania/src/ScreenNetworkOptions.cpp @@ -151,8 +151,8 @@ void ScreenNetworkOptions::MenuStart( PlayerNumber pn, const InputEventType type #endif } -void ScreenNetworkOptions::ImportOptions() { } -void ScreenNetworkOptions::ExportOptions() { } +void ScreenNetworkOptions::ImportOptions( int row ) { } +void ScreenNetworkOptions::ExportOptions( int row ) { } void ScreenNetworkOptions::UpdateConnectStatus( ) { diff --git a/stepmania/src/ScreenNetworkOptions.h b/stepmania/src/ScreenNetworkOptions.h index b4f7e741ee..45e1dfe5f7 100644 --- a/stepmania/src/ScreenNetworkOptions.h +++ b/stepmania/src/ScreenNetworkOptions.h @@ -14,8 +14,8 @@ public: virtual void MenuStart( PlayerNumber pn, const InputEventType type ); private: - void ImportOptions(); - void ExportOptions(); + void ImportOptions( int row ); + void ExportOptions( int row ); void GoToNextScreen(); void GoToPrevScreen(); diff --git a/stepmania/src/ScreenOptions.cpp b/stepmania/src/ScreenOptions.cpp index ca6d785995..2ff63d40f4 100644 --- a/stepmania/src/ScreenOptions.cpp +++ b/stepmania/src/ScreenOptions.cpp @@ -158,21 +158,17 @@ void ScreenOptions::InitMenu( InputMode im, OptionRowDefinition defs[], int iNum m_bShowUnderlines = bShowUnderlines; - for( int r=0; rImportOptions(); - Font* pFont = FONT->LoadFont( THEME->GetPathF(m_sName,"item") ); for( int r=0; rImportOptions( r ); + CHECKPOINT_M( ssprintf("row %i: %s", r, row.GetRowDef().name.c_str()) ); unsigned pos = r; @@ -574,7 +570,8 @@ void ScreenOptions::HandleScreenMessage( const ScreenMessage SM ) this->GoToPrevScreen(); break; case SM_GoToNextScreen: - this->ExportOptions(); + for( unsigned r=0; rExportOptions(r); this->GoToNextScreen(); break; case SM_BeginFadingOut: @@ -1144,41 +1141,35 @@ void ScreenOptions::RefreshRowChoices( int r, const OptionRowDefinition &newdef { OptionRow &row = *m_Rows[r]; - // For now, update only m_vEnabledForPlayers - 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 ) + switch( row.GetRowType() ) { case OptionRow::ROW_NORMAL: - row.LoadNormal( def ); - row.AfterImportOptions( - pFont, - ITEMS_START_X, - ITEMS_GAP_X, - ITEMS_END_X, - ITEMS_LONG_ROW_SHARED_X, - ITEMS_LONG_ROW_X, - ITEMS_ZOOM, - CAPITALIZE_ALL_OPTION_NAMES, - THEME->GetPathF(m_sName,"item"), - THEME->GetPathF(m_sName,"title"), - GetExplanationTitle( r ), - THEME->GetPathG(m_sName,"bullet"), - LABELS_X, - ARROWS_X, - row.GetRowY(), - LABELS_ON_COMMAND - ); - + { + Font* pFont = FONT->LoadFont( THEME->GetPathF(m_sName,"item") ); + row.Clear(); + row.LoadNormal( newdef ); + row.AfterImportOptions( + pFont, + ITEMS_START_X, + ITEMS_GAP_X, + ITEMS_END_X, + ITEMS_LONG_ROW_SHARED_X, + ITEMS_LONG_ROW_X, + ITEMS_ZOOM, + CAPITALIZE_ALL_OPTION_NAMES, + THEME->GetPathF(m_sName,"item"), + THEME->GetPathF(m_sName,"title"), + GetExplanationTitle( r ), + THEME->GetPathG(m_sName,"bullet"), + LABELS_X, + ARROWS_X, + row.GetRowY(), + LABELS_ON_COMMAND + ); + FONT->UnloadFont( pFont ); + pFont = NULL; + UpdateEnabledDisabled( r ); + } break; case OptionRow::ROW_EXIT: // nothing to do @@ -1186,10 +1177,6 @@ void ScreenOptions::RefreshRowChoices( int r, const OptionRowDefinition &newdef default: ASSERT(0); } - - FONT->UnloadFont( pFont ); - pFont = NULL; - */ } /* diff --git a/stepmania/src/ScreenOptions.h b/stepmania/src/ScreenOptions.h index abb16a8f4a..03fe7b1cb9 100644 --- a/stepmania/src/ScreenOptions.h +++ b/stepmania/src/ScreenOptions.h @@ -31,8 +31,8 @@ public: virtual void HandleScreenMessage( const ScreenMessage SM ); protected: - virtual void ImportOptions() = 0; - virtual void ExportOptions() = 0; + virtual void ImportOptions( int row ) = 0; + virtual void ExportOptions( int row ) = 0; void InitOptionsText(); void GetWidthXY( PlayerNumber pn, int iRow, int iChoiceOnRow, int &iWidthOut, int &iXOut, int &iYOut ); CString GetExplanationText( int row ) const; diff --git a/stepmania/src/ScreenOptionsMaster.cpp b/stepmania/src/ScreenOptionsMaster.cpp index 7347781e41..7a52b4aa6f 100644 --- a/stepmania/src/ScreenOptionsMaster.cpp +++ b/stepmania/src/ScreenOptionsMaster.cpp @@ -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[i]; - const OptionRowDefinition &def = m_OptionRowAlloc[i]; - OptionRow &row = *m_Rows[i]; + const OptionRowHandler &hand = OptionRowHandlers[r]; + const OptionRowDefinition &def = m_OptionRowAlloc[r]; + OptionRow &row = *m_Rows[r]; - if( def.bOneChoiceForAllPlayers ) - { - ImportOption(def, hand, PLAYER_1, i, row.m_vbSelected[0] ); - } - else - { - FOREACH_HumanPlayer( p ) - { - ImportOption( def, hand, p, i, row.m_vbSelected[p] ); - } - } + if( def.bOneChoiceForAllPlayers ) + { + ImportOption(def, hand, PLAYER_1, r, row.m_vbSelected[0] ); + } + else + { + FOREACH_HumanPlayer( p ) + ImportOption( def, hand, p, r, row.m_vbSelected[p] ); } } @@ -862,9 +857,8 @@ int ScreenOptionsMaster::ExportOption( const OptionRowDefinition &row, const Opt return 0; } -int ScreenOptionsMaster::ExportOptionForAllPlayers( int iRow ) +void ScreenOptionsMaster::ExportOptions( int iRow ) { - int iChangeMask = 0; const OptionRowHandler &hand = OptionRowHandlers[iRow]; const OptionRowDefinition &def = m_OptionRowAlloc[iRow]; OptionRow &row = *m_Rows[iRow]; @@ -872,93 +866,8 @@ int ScreenOptionsMaster::ExportOptionForAllPlayers( int iRow ) { vector &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() @@ -1040,7 +949,7 @@ void ScreenOptionsMaster::ChangeValueInRow( PlayerNumber pn, int iDelta, bool Re const OptionRowHandler &hand = OptionRowHandlers[iRow]; if( hand.m_bExportOnChange || !hand.m_vsRefreshRowNames.empty() ) - ExportOptionForAllPlayers( iRow ); + ExportOptions( iRow ); 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 diff --git a/stepmania/src/ScreenOptionsMaster.h b/stepmania/src/ScreenOptionsMaster.h index 3c73652857..7e22350298 100644 --- a/stepmania/src/ScreenOptionsMaster.h +++ b/stepmania/src/ScreenOptionsMaster.h @@ -23,7 +23,7 @@ public: virtual ~ScreenOptionsMaster(); void Update( float fDelta ); -private: +protected: struct OptionRowHandler { @@ -58,6 +58,7 @@ private: const ConfOption *opt; }; + int m_iChangeMask; CString m_sNextScreen; vector OptionRowHandlers; @@ -65,7 +66,6 @@ private: int ExportOption( const OptionRowDefinition &def, const OptionRowHandler &hand, PlayerNumber pn, const vector &vbSelected ); void ImportOption( const OptionRowDefinition &def, const OptionRowHandler &hand, PlayerNumber pn, int rowno, vector &vbSelectedOut ); - int ExportOptionForAllPlayers( int iRow ); static void SetList( OptionRowDefinition &def, OptionRowHandler &hand, CString param ); static void SetLua( OptionRowDefinition &def, OptionRowHandler &hand, const CString &sLuaFunction ); @@ -77,10 +77,12 @@ private: static void SetDifficulties( OptionRowDefinition &def, OptionRowHandler &hand ); protected: + void HandleScreenMessage( const ScreenMessage SM ); + virtual void ChangeValueInRow( PlayerNumber pn, int iDelta, bool Repeat ); - virtual void ImportOptions(); - virtual void ExportOptions(); + virtual void ImportOptions( int row ); + virtual void ExportOptions( int row ); virtual void ImportOptionsForPlayer( PlayerNumber pn ); // used by ScreenPlayerOptions virtual void GoToNextScreen(); diff --git a/stepmania/src/ScreenPlayerOptions.cpp b/stepmania/src/ScreenPlayerOptions.cpp index 64e6042ba2..6bfeb8290a 100644 --- a/stepmania/src/ScreenPlayerOptions.cpp +++ b/stepmania/src/ScreenPlayerOptions.cpp @@ -185,15 +185,14 @@ void ScreenPlayerOptions::HandleScreenMessage( const ScreenMessage SM ) void ScreenPlayerOptions::UpdateDisqualified() { // save current player options - PlayerOptions po[2]; + PlayerOptions po[NUM_PLAYERS]; FOREACH_PlayerNumber( p ) - { po[p] = GAMESTATE->m_pPlayerState[p]->m_PlayerOptions; - } // export the currently selection options, which will fill GAMESTATE->m_PlayerOptions - ScreenOptionsMaster::ExportOptions(); + for( unsigned r=0; rPlayMusic( THEME->GetPathS("ScreenMachineOptions","music") ); } -void ScreenProfileOptions::ImportOptions() +void ScreenProfileOptions::ImportOptions( int row ) { - vector vsProfiles; - PROFILEMAN->GetLocalProfileIDs( vsProfiles ); + switch( row ) + { + case PO_PLAYER1: + case PO_PLAYER2: + { + PlayerNumber pn = (PlayerNumber)(row - PO_PLAYER1); + vector vsProfiles; + PROFILEMAN->GetLocalProfileIDs( vsProfiles ); - CStringArray::iterator iter; - - iter = find( - vsProfiles.begin(), - vsProfiles.end(), - PREFSMAN->m_sDefaultLocalProfileID[PLAYER_1] ); - if( iter != vsProfiles.end() ) - m_Rows[PO_PLAYER1]->SetOneSharedSelection( iter - vsProfiles.begin() + 1 ); - - iter = find( - vsProfiles.begin(), - vsProfiles.end(), - PREFSMAN->m_sDefaultLocalProfileID[PLAYER_2] ); - if( iter != vsProfiles.end() ) - m_Rows[PO_PLAYER2]->SetOneSharedSelection( iter - vsProfiles.begin() + 1 ); + CStringArray::iterator iter = find( + vsProfiles.begin(), + vsProfiles.end(), + PREFSMAN->m_sDefaultLocalProfileID[pn] ); + if( iter != vsProfiles.end() ) + m_Rows[row]->SetOneSharedSelection( iter - vsProfiles.begin() + 1 ); + } + break; + } } -void ScreenProfileOptions::ExportOptions() +void ScreenProfileOptions::ExportOptions( int row ) { - vector vsProfiles; - PROFILEMAN->GetLocalProfileIDs( vsProfiles ); + switch( row ) + { + case PO_PLAYER1: + case PO_PLAYER2: + { + PlayerNumber pn = (PlayerNumber)(row - PO_PLAYER1); + vector vsProfiles; + PROFILEMAN->GetLocalProfileIDs( vsProfiles ); - if( m_Rows[PO_PLAYER1]->GetOneSharedSelection() > 0 ) - PREFSMAN->m_sDefaultLocalProfileID[PLAYER_1] = vsProfiles[m_Rows[PO_PLAYER1]->GetOneSharedSelection()-1]; - else - PREFSMAN->m_sDefaultLocalProfileID[PLAYER_1] = ""; - - if( m_Rows[PO_PLAYER2]->GetOneSharedSelection() > 0 ) - PREFSMAN->m_sDefaultLocalProfileID[PLAYER_2] = vsProfiles[m_Rows[PO_PLAYER2]->GetOneSharedSelection()-1]; - else - PREFSMAN->m_sDefaultLocalProfileID[PLAYER_2] = ""; + if( m_Rows[row]->GetOneSharedSelection() > 0 ) + PREFSMAN->m_sDefaultLocalProfileID[pn] = vsProfiles[m_Rows[row]->GetOneSharedSelection()-1]; + else + PREFSMAN->m_sDefaultLocalProfileID[pn] = ""; + } + break; + } } void ScreenProfileOptions::GoToPrevScreen() diff --git a/stepmania/src/ScreenProfileOptions.h b/stepmania/src/ScreenProfileOptions.h index 7b81baf031..65ff1aeaf1 100644 --- a/stepmania/src/ScreenProfileOptions.h +++ b/stepmania/src/ScreenProfileOptions.h @@ -14,8 +14,8 @@ public: virtual void MenuStart( PlayerNumber pn, const InputEventType type ); private: - void ImportOptions(); - void ExportOptions(); + void ImportOptions( int row ); + void ExportOptions( int row ); void GoToNextScreen(); void GoToPrevScreen(); diff --git a/stepmania/src/ScreenSMOnlineLogin.cpp b/stepmania/src/ScreenSMOnlineLogin.cpp index f8fcd06289..5e54133974 100644 --- a/stepmania/src/ScreenSMOnlineLogin.cpp +++ b/stepmania/src/ScreenSMOnlineLogin.cpp @@ -51,29 +51,43 @@ void ScreenSMOnlineLogin::Init() } } -void ScreenSMOnlineLogin::ImportOptions() +void ScreenSMOnlineLogin::ImportOptions( int row ) { - vector vsProfiles; - PROFILEMAN->GetLocalProfileIDs( vsProfiles ); - - CStringArray::iterator iter; - - FOREACH_PlayerNumber( pn ) + switch( row ) { - iter = find(vsProfiles.begin(), vsProfiles.end(), PREFSMAN->m_sDefaultLocalProfileID[pn] ); - if( iter != vsProfiles.end() ) - m_Rows[0]->SetOneSelection((PlayerNumber) pn, iter - vsProfiles.begin()); + case 0: + { + vector 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 vsProfiles; - PROFILEMAN->GetLocalProfileIDs( vsProfiles ); - - FOREACH_EnabledPlayer( pn ) + switch( row ) { - PREFSMAN->m_sDefaultLocalProfileID[pn] = vsProfiles[m_Rows[0]->GetOneSelection((PlayerNumber) pn)]; + case 0: + { + vector 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() { - ExportOptions(); + for( unsigned r=0; rSaveGlobalPrefsToDisk(); FOREACH_EnabledPlayer(pn) { diff --git a/stepmania/src/ScreenSMOnlineLogin.h b/stepmania/src/ScreenSMOnlineLogin.h index 12f69edca6..08237cc33e 100644 --- a/stepmania/src/ScreenSMOnlineLogin.h +++ b/stepmania/src/ScreenSMOnlineLogin.h @@ -13,8 +13,8 @@ public: void SendLogin(CString sPassword); private: - void ImportOptions(); - void ExportOptions(); + void ImportOptions( int row ); + void ExportOptions( int row ); void GoToNextScreen(); void GoToPrevScreen(); CString GetSelectedProfileID();