fix options menu loading every other menu
This commit is contained in:
@@ -570,47 +570,59 @@ int ScreenOptionsMaster::ExportOption( const OptionRowDefinition &row, const Opt
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int ScreenOptionsMaster::ExportOptionForAllPlayers( int iRow )
|
||||||
|
{
|
||||||
|
int iChangeMask = 0;
|
||||||
|
const OptionRowHandler &hand = OptionRowHandlers[iRow];
|
||||||
|
const OptionRowDefinition &data = m_OptionRowAlloc[iRow];
|
||||||
|
OptionRow &row = *m_Rows[iRow];
|
||||||
|
FOREACH_HumanPlayer( pn )
|
||||||
|
{
|
||||||
|
vector<bool> &vbSelected = row.m_vbSelected[pn];
|
||||||
|
|
||||||
|
iChangeMask |= ExportOption( data, hand, pn, vbSelected );
|
||||||
|
}
|
||||||
|
return iChangeMask;
|
||||||
|
}
|
||||||
|
|
||||||
void ScreenOptionsMaster::ExportOptions()
|
void ScreenOptionsMaster::ExportOptions()
|
||||||
{
|
{
|
||||||
int ChangeMask = 0;
|
int ChangeMask = 0;
|
||||||
|
|
||||||
CHECKPOINT;
|
CHECKPOINT;
|
||||||
for( unsigned i = 0; i < OptionRowHandlers.size(); ++i )
|
const unsigned row = this->GetCurrentRow();
|
||||||
{
|
|
||||||
CHECKPOINT_M( ssprintf("%i/%i", i, int(OptionRowHandlers.size())) );
|
|
||||||
|
|
||||||
const OptionRowHandler &hand = OptionRowHandlers[i];
|
|
||||||
const OptionRowDefinition &data = m_OptionRowAlloc[i];
|
|
||||||
OptionRow &row = *m_Rows[i];
|
|
||||||
|
|
||||||
FOREACH_HumanPlayer( p )
|
|
||||||
{
|
|
||||||
vector<bool> &vbSelected = row.m_vbSelected[p];
|
|
||||||
|
|
||||||
ChangeMask |= ExportOption( data, hand, p, vbSelected );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CHECKPOINT;
|
|
||||||
/* If the selection is on a LIST, and the selected LIST option sets the screen,
|
/* If the selection is on a LIST, and the selected LIST option sets the screen,
|
||||||
* honor it. */
|
* honor it. */
|
||||||
m_sNextScreen = "";
|
m_sNextScreen = "";
|
||||||
|
|
||||||
const int row = this->GetCurrentRow();
|
for( unsigned i = 0; i < OptionRowHandlers.size(); ++i )
|
||||||
if( row != -1 )
|
|
||||||
{
|
{
|
||||||
const OptionRowHandler &hand = OptionRowHandlers[row];
|
CHECKPOINT_M( ssprintf("%i/%i", i, int(OptionRowHandlers.size())) );
|
||||||
|
|
||||||
|
/* If SELECT_NONE, only apply it if it's the selected option. */
|
||||||
|
const OptionRowDefinition &data = m_OptionRowAlloc[i];
|
||||||
|
if( data.selectType == SELECT_NONE && i != row )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
OptionRowHandler &hand = OptionRowHandlers[i];
|
||||||
|
|
||||||
if( hand.type == ROW_LIST )
|
if( hand.type == ROW_LIST )
|
||||||
{
|
{
|
||||||
const int choice = m_Rows[row]->m_iChoiceInRowWithFocus[GAMESTATE->m_MasterPlayerNumber];
|
const int choice = m_Rows[i]->m_iChoiceInRowWithFocus[GAMESTATE->m_MasterPlayerNumber];
|
||||||
const GameCommand &mc = hand.ListEntries[choice];
|
GameCommand &mc = hand.ListEntries[choice];
|
||||||
if( mc.m_sScreen != "" )
|
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;
|
m_sNextScreen = mc.m_sScreen;
|
||||||
// Why were we re-applying his here? ExportOption() is where options
|
mc.m_sScreen = "";
|
||||||
// are applied.
|
|
||||||
// mc.Apply( GAMESTATE->m_MasterPlayerNumber );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ExportOptionForAllPlayers( i );
|
||||||
|
}
|
||||||
CHECKPOINT;
|
CHECKPOINT;
|
||||||
|
|
||||||
// NEXT_SCREEN;
|
// NEXT_SCREEN;
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ private:
|
|||||||
|
|
||||||
int ExportOption( const OptionRowDefinition &row, const OptionRowHandler &hand, PlayerNumber pn, const vector<bool> &vbSelected );
|
int ExportOption( const OptionRowDefinition &row, const OptionRowHandler &hand, PlayerNumber pn, const vector<bool> &vbSelected );
|
||||||
void ImportOption( const OptionRowDefinition &row, const OptionRowHandler &hand, PlayerNumber pn, int rowno, vector<bool> &vbSelectedOut );
|
void ImportOption( const OptionRowDefinition &row, const OptionRowHandler &hand, PlayerNumber pn, int rowno, vector<bool> &vbSelectedOut );
|
||||||
|
int ExportOptionForAllPlayers( int iRow );
|
||||||
|
|
||||||
static void SetList( OptionRowDefinition &row, OptionRowHandler &hand, CString param );
|
static void SetList( OptionRowDefinition &row, OptionRowHandler &hand, CString param );
|
||||||
static void SetSteps( OptionRowDefinition &row, OptionRowHandler &hand );
|
static void SetSteps( OptionRowDefinition &row, OptionRowHandler &hand );
|
||||||
|
|||||||
Reference in New Issue
Block a user