export specific rows, not all rows at once, to make it easier to reload certain rows
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -80,6 +80,7 @@ public:
|
||||
OptionRow();
|
||||
~OptionRow();
|
||||
|
||||
void Clear();
|
||||
void LoadNormal( const OptionRowDefinition &def );
|
||||
void LoadExit(
|
||||
const CString &sFontPath,
|
||||
|
||||
@@ -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( )
|
||||
{
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -158,20 +158,16 @@ void ScreenOptions::InitMenu( InputMode im, OptionRowDefinition defs[], int iNum
|
||||
|
||||
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") );
|
||||
|
||||
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()) );
|
||||
|
||||
@@ -574,7 +570,8 @@ void ScreenOptions::HandleScreenMessage( const ScreenMessage SM )
|
||||
this->GoToPrevScreen();
|
||||
break;
|
||||
case SM_GoToNextScreen:
|
||||
this->ExportOptions();
|
||||
for( unsigned r=0; r<m_Rows.size(); r++ ) // foreach row
|
||||
this->ExportOptions(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;
|
||||
*/
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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<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()
|
||||
@@ -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
|
||||
|
||||
@@ -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<OptionRowHandler> OptionRowHandlers;
|
||||
@@ -65,7 +66,6 @@ private:
|
||||
|
||||
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 );
|
||||
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();
|
||||
|
||||
@@ -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; r<OptionRowHandlers.size(); r++ )
|
||||
ScreenOptionsMaster::ExportOptions( r );
|
||||
|
||||
FOREACH_HumanPlayer( p )
|
||||
{
|
||||
|
||||
@@ -80,42 +80,46 @@ void ScreenProfileOptions::Init()
|
||||
SOUND->PlayMusic( THEME->GetPathS("ScreenMachineOptions","music") );
|
||||
}
|
||||
|
||||
void ScreenProfileOptions::ImportOptions()
|
||||
void ScreenProfileOptions::ImportOptions( int row )
|
||||
{
|
||||
vector<CString> vsProfiles;
|
||||
PROFILEMAN->GetLocalProfileIDs( vsProfiles );
|
||||
switch( row )
|
||||
{
|
||||
case PO_PLAYER1:
|
||||
case PO_PLAYER2:
|
||||
{
|
||||
PlayerNumber pn = (PlayerNumber)(row - PO_PLAYER1);
|
||||
vector<CString> 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<CString> vsProfiles;
|
||||
PROFILEMAN->GetLocalProfileIDs( vsProfiles );
|
||||
switch( row )
|
||||
{
|
||||
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 )
|
||||
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()
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -51,29 +51,43 @@ void ScreenSMOnlineLogin::Init()
|
||||
}
|
||||
}
|
||||
|
||||
void ScreenSMOnlineLogin::ImportOptions()
|
||||
void ScreenSMOnlineLogin::ImportOptions( int row )
|
||||
{
|
||||
vector<CString> 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<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;
|
||||
PROFILEMAN->GetLocalProfileIDs( vsProfiles );
|
||||
|
||||
FOREACH_EnabledPlayer( pn )
|
||||
switch( row )
|
||||
{
|
||||
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()
|
||||
{
|
||||
ExportOptions();
|
||||
for( unsigned r=0; r<m_Rows.size(); r++ )
|
||||
ExportOptions( r );
|
||||
PREFSMAN->SaveGlobalPrefsToDisk();
|
||||
FOREACH_EnabledPlayer(pn)
|
||||
{
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user