fix skip when changing value in row:
broadcast the row export only once - not for each player disable export/import on reload - nothing uses it yet
This commit is contained in:
+66
-29
@@ -720,9 +720,17 @@ void OptionRow::Reload()
|
|||||||
if( m_pHand == NULL )
|
if( m_pHand == NULL )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( m_RowDef.m_bExportOnChange )
|
vector<PlayerNumber> vpns;
|
||||||
FOREACH_HumanPlayer( p )
|
FOREACH_HumanPlayer( p )
|
||||||
ExportOptions( p, false );
|
vpns.push_back( p );
|
||||||
|
|
||||||
|
// TODO: Nothing uses this yet and it causes skips when changing options.
|
||||||
|
//if( m_RowDef.m_bExportOnChange )
|
||||||
|
//{
|
||||||
|
// bool bRowHasFocus[NUM_PLAYERS];
|
||||||
|
// ZERO( bRowHasFocus );
|
||||||
|
// ExportOptions( vpns, bRowHasFocus );
|
||||||
|
//}
|
||||||
|
|
||||||
m_pHand->Reload( m_RowDef );
|
m_pHand->Reload( m_RowDef );
|
||||||
ASSERT( !m_RowDef.choices.empty() );
|
ASSERT( !m_RowDef.choices.empty() );
|
||||||
@@ -730,8 +738,8 @@ void OptionRow::Reload()
|
|||||||
FOREACH_PlayerNumber( p )
|
FOREACH_PlayerNumber( p )
|
||||||
m_vbSelected[p].resize( m_RowDef.choices.size(), false );
|
m_vbSelected[p].resize( m_RowDef.choices.size(), false );
|
||||||
|
|
||||||
FOREACH_HumanPlayer( p )
|
// TODO: Nothing uses this yet and it causes skips when changing options.
|
||||||
ImportOptions( p );
|
//ImportOptions( vpns );
|
||||||
|
|
||||||
switch( m_RowDef.selectType )
|
switch( m_RowDef.selectType )
|
||||||
{
|
{
|
||||||
@@ -747,9 +755,13 @@ void OptionRow::Reload()
|
|||||||
ASSERT(0);
|
ASSERT(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if( m_RowDef.m_bExportOnChange )
|
// TODO: Nothing uses this yet and it causes skips when changing options.
|
||||||
FOREACH_HumanPlayer( p )
|
//if( m_RowDef.m_bExportOnChange )
|
||||||
ExportOptions( p, false );
|
//{
|
||||||
|
// bool bRowHasFocus[NUM_PLAYERS];
|
||||||
|
// ZERO( bRowHasFocus );
|
||||||
|
// ExportOptions( vpns, bRowHasFocus );
|
||||||
|
//}
|
||||||
|
|
||||||
UpdateEnabledDisabled();
|
UpdateEnabledDisabled();
|
||||||
UpdateText();
|
UpdateText();
|
||||||
@@ -792,24 +804,36 @@ static void VerifySelected( SelectType st, const vector<bool> &vbSelected, const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void OptionRow::ImportOptions( PlayerNumber pn )
|
void OptionRow::ImportOptions( const vector<PlayerNumber> &vpns )
|
||||||
{
|
{
|
||||||
if( m_pHand == NULL )
|
if( m_pHand == NULL )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ASSERT( m_RowDef.choices.size() > 0 );
|
ASSERT( m_RowDef.choices.size() > 0 );
|
||||||
|
|
||||||
FOREACH( bool, m_vbSelected[pn], b )
|
FOREACH_CONST( PlayerNumber, vpns, iter )
|
||||||
*b = false;
|
{
|
||||||
|
PlayerNumber p = *iter;
|
||||||
|
|
||||||
ASSERT( m_vbSelected[pn].size() == m_RowDef.choices.size() );
|
FOREACH( bool, m_vbSelected[p], b )
|
||||||
ERASE_ONE_BOOL_AT_FRONT_IF_NEEDED( m_vbSelected[pn] );
|
*b = false;
|
||||||
m_pHand->ImportOption( m_RowDef, pn, m_vbSelected[pn] );
|
|
||||||
INSERT_ONE_BOOL_AT_FRONT_IF_NEEDED( m_vbSelected[pn] );
|
ASSERT( m_vbSelected[p].size() == m_RowDef.choices.size() );
|
||||||
VerifySelected( m_RowDef.selectType, m_vbSelected[pn], m_RowDef.name );
|
ERASE_ONE_BOOL_AT_FRONT_IF_NEEDED( m_vbSelected[p] );
|
||||||
|
}
|
||||||
|
|
||||||
|
m_pHand->ImportOption( m_RowDef, vpns, m_vbSelected );
|
||||||
|
|
||||||
|
FOREACH_CONST( PlayerNumber, vpns, iter )
|
||||||
|
{
|
||||||
|
PlayerNumber p = *iter;
|
||||||
|
|
||||||
|
INSERT_ONE_BOOL_AT_FRONT_IF_NEEDED( m_vbSelected[p] );
|
||||||
|
VerifySelected( m_RowDef.selectType, m_vbSelected[p], m_RowDef.name );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int OptionRow::ExportOptions( PlayerNumber pn, bool bRowHasFocus )
|
int OptionRow::ExportOptions( const vector<PlayerNumber> &vpns, bool bRowHasFocus[NUM_PLAYERS] )
|
||||||
{
|
{
|
||||||
if( m_pHand == NULL )
|
if( m_pHand == NULL )
|
||||||
return 0;
|
return 0;
|
||||||
@@ -818,22 +842,35 @@ int OptionRow::ExportOptions( PlayerNumber pn, bool bRowHasFocus )
|
|||||||
|
|
||||||
int iChangeMask = 0;
|
int iChangeMask = 0;
|
||||||
|
|
||||||
VerifySelected( m_RowDef.selectType, m_vbSelected[pn], m_RowDef.name );
|
FOREACH_CONST( PlayerNumber, vpns, iter )
|
||||||
ASSERT( m_vbSelected[pn].size() == m_RowDef.choices.size() );
|
{
|
||||||
ERASE_ONE_BOOL_AT_FRONT_IF_NEEDED( m_vbSelected[pn] );
|
PlayerNumber p = *iter;
|
||||||
|
bool bFocus = bRowHasFocus[p];
|
||||||
|
|
||||||
// SELECT_NONE rows get exported if they have focus when the user presses
|
VerifySelected( m_RowDef.selectType, m_vbSelected[p], m_RowDef.name );
|
||||||
// Start.
|
ASSERT( m_vbSelected[p].size() == m_RowDef.choices.size() );
|
||||||
int iChoice = GetChoiceInRowWithFocus( pn );
|
ERASE_ONE_BOOL_AT_FRONT_IF_NEEDED( m_vbSelected[p] );
|
||||||
if( m_RowDef.selectType == SELECT_NONE && bRowHasFocus )
|
|
||||||
m_vbSelected[pn][iChoice] = true;
|
|
||||||
|
|
||||||
iChangeMask |= m_pHand->ExportOption( m_RowDef, pn, m_vbSelected[pn] );
|
// SELECT_NONE rows get exported if they have focus when the user presses
|
||||||
|
// Start.
|
||||||
|
int iChoice = GetChoiceInRowWithFocus( p );
|
||||||
|
if( m_RowDef.selectType == SELECT_NONE && bFocus )
|
||||||
|
m_vbSelected[p][iChoice] = true;
|
||||||
|
}
|
||||||
|
|
||||||
if( m_RowDef.selectType == SELECT_NONE && bRowHasFocus )
|
iChangeMask |= m_pHand->ExportOption( m_RowDef, vpns, m_vbSelected );
|
||||||
m_vbSelected[pn][iChoice] = false;
|
|
||||||
|
|
||||||
INSERT_ONE_BOOL_AT_FRONT_IF_NEEDED( m_vbSelected[pn] );
|
FOREACH_CONST( PlayerNumber, vpns, iter )
|
||||||
|
{
|
||||||
|
PlayerNumber p = *iter;
|
||||||
|
bool bFocus = bRowHasFocus[p];
|
||||||
|
|
||||||
|
int iChoice = GetChoiceInRowWithFocus( p );
|
||||||
|
if( m_RowDef.selectType == SELECT_NONE && bFocus )
|
||||||
|
m_vbSelected[p][iChoice] = false;
|
||||||
|
|
||||||
|
INSERT_ONE_BOOL_AT_FRONT_IF_NEEDED( m_vbSelected[p] );
|
||||||
|
}
|
||||||
|
|
||||||
return iChangeMask;
|
return iChangeMask;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -90,8 +90,8 @@ public:
|
|||||||
|
|
||||||
CString GetRowTitle() const;
|
CString GetRowTitle() const;
|
||||||
|
|
||||||
void ImportOptions( PlayerNumber pn );
|
void ImportOptions( const vector<PlayerNumber> &vpns );
|
||||||
int ExportOptions( PlayerNumber pn, bool bRowHasFocus );
|
int ExportOptions( const vector<PlayerNumber> &vpns, bool bRowHasFocus[NUM_PLAYERS] );
|
||||||
|
|
||||||
void AfterImportOptions( float fY );
|
void AfterImportOptions( float fY );
|
||||||
void DetachHandler();
|
void DetachHandler();
|
||||||
|
|||||||
+368
-293
@@ -151,75 +151,87 @@ public:
|
|||||||
defOut.choices.push_back( sChoice );
|
defOut.choices.push_back( sChoice );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void ImportOption( const OptionRowDefinition &def, PlayerNumber pn, vector<bool> &vbSelectedOut ) const
|
void ImportOption( const OptionRowDefinition &def, const vector<PlayerNumber> &vpns, vector<bool> vbSelectedOut[NUM_PLAYERS] ) const
|
||||||
{
|
{
|
||||||
int FallbackOption = -1;
|
int FallbackOption = -1;
|
||||||
bool UseFallbackOption = true;
|
bool UseFallbackOption = true;
|
||||||
|
|
||||||
for( unsigned e = 0; e < ListEntries.size(); ++e )
|
FOREACH_CONST( PlayerNumber, vpns, pn )
|
||||||
{
|
{
|
||||||
const GameCommand &mc = ListEntries[e];
|
PlayerNumber p = *pn;
|
||||||
|
vector<bool> &vbSelOut = vbSelectedOut[p];
|
||||||
|
|
||||||
vbSelectedOut[e] = false;
|
for( unsigned e = 0; e < ListEntries.size(); ++e )
|
||||||
|
|
||||||
if( mc.IsZero() )
|
|
||||||
{
|
{
|
||||||
/* The entry has no effect. This is usually a default "none of the
|
const GameCommand &mc = ListEntries[e];
|
||||||
* above" entry. It will always return true for DescribesCurrentMode().
|
|
||||||
* It's only the selected choice if nothing else matches. */
|
|
||||||
if( def.selectType != SELECT_MULTIPLE )
|
|
||||||
FallbackOption = e;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( def.bOneChoiceForAllPlayers )
|
vbSelOut[e] = false;
|
||||||
{
|
|
||||||
if( mc.DescribesCurrentModeForAllPlayers() )
|
if( mc.IsZero() )
|
||||||
{
|
{
|
||||||
UseFallbackOption = false;
|
/* The entry has no effect. This is usually a default "none of the
|
||||||
|
* above" entry. It will always return true for DescribesCurrentMode().
|
||||||
|
* It's only the selected choice if nothing else matches. */
|
||||||
if( def.selectType != SELECT_MULTIPLE )
|
if( def.selectType != SELECT_MULTIPLE )
|
||||||
SelectExactlyOne( e, vbSelectedOut );
|
FallbackOption = e;
|
||||||
else
|
continue;
|
||||||
vbSelectedOut[e] = true;
|
}
|
||||||
|
|
||||||
|
if( def.bOneChoiceForAllPlayers )
|
||||||
|
{
|
||||||
|
if( mc.DescribesCurrentModeForAllPlayers() )
|
||||||
|
{
|
||||||
|
UseFallbackOption = false;
|
||||||
|
if( def.selectType != SELECT_MULTIPLE )
|
||||||
|
SelectExactlyOne( e, vbSelOut );
|
||||||
|
else
|
||||||
|
vbSelOut[e] = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if( mc.DescribesCurrentMode( p) )
|
||||||
|
{
|
||||||
|
UseFallbackOption = false;
|
||||||
|
if( def.selectType != SELECT_MULTIPLE )
|
||||||
|
SelectExactlyOne( e, vbSelOut );
|
||||||
|
else
|
||||||
|
vbSelOut[e] = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
if( UseFallbackOption && FallbackOption == -1 )
|
||||||
{
|
{
|
||||||
if( mc.DescribesCurrentMode( pn) )
|
LOG->Warn( "No options in row \"%s\" were selected, and no fallback row found; selected entry 0", m_sName.c_str() );
|
||||||
{
|
FallbackOption = 0;
|
||||||
UseFallbackOption = false;
|
|
||||||
if( def.selectType != SELECT_MULTIPLE )
|
|
||||||
SelectExactlyOne( e, vbSelectedOut );
|
|
||||||
else
|
|
||||||
vbSelectedOut[e] = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if( UseFallbackOption && FallbackOption == -1 )
|
if( def.selectType == SELECT_ONE &&
|
||||||
{
|
UseFallbackOption &&
|
||||||
LOG->Warn( "No options in row \"%s\" were selected, and no fallback row found; selected entry 0", m_sName.c_str() );
|
FallbackOption != -1 )
|
||||||
FallbackOption = 0;
|
{
|
||||||
}
|
SelectExactlyOne( FallbackOption, vbSelOut );
|
||||||
|
}
|
||||||
if( def.selectType == SELECT_ONE &&
|
|
||||||
UseFallbackOption &&
|
|
||||||
FallbackOption != -1 )
|
|
||||||
{
|
|
||||||
SelectExactlyOne( FallbackOption, vbSelectedOut );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int ExportOption( const OptionRowDefinition &def, PlayerNumber pn, const vector<bool> &vbSelected ) const
|
int ExportOption( const OptionRowDefinition &def, const vector<PlayerNumber> &vpns, const vector<bool> vbSelected[NUM_PLAYERS] ) const
|
||||||
{
|
{
|
||||||
Default.Apply( pn );
|
FOREACH_CONST( PlayerNumber, vpns, pn )
|
||||||
for( unsigned i=0; i<vbSelected.size(); i++ )
|
|
||||||
{
|
{
|
||||||
if( vbSelected[i] )
|
PlayerNumber p = *pn;
|
||||||
ListEntries[i].Apply( pn );
|
const vector<bool> &vbSel = vbSelected[p];
|
||||||
|
|
||||||
|
Default.Apply( p );
|
||||||
|
for( unsigned i=0; i<vbSel.size(); i++ )
|
||||||
|
{
|
||||||
|
if( vbSel[i] )
|
||||||
|
ListEntries[i].Apply( p );
|
||||||
|
}
|
||||||
|
FOREACH_CONST( CString, m_vsBroadcastOnExport, s )
|
||||||
|
MESSAGEMAN->Broadcast( *s );
|
||||||
}
|
}
|
||||||
FOREACH_CONST( CString, m_vsBroadcastOnExport, s )
|
|
||||||
MESSAGEMAN->Broadcast( *s );
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -500,55 +512,103 @@ public:
|
|||||||
if( m_pLuaTable->GetLuaType() != LUA_TTABLE )
|
if( m_pLuaTable->GetLuaType() != LUA_TTABLE )
|
||||||
RageException::Throw( "Result of \"%s\" is not a table", sLuaFunction.c_str() );
|
RageException::Throw( "Result of \"%s\" is not a table", sLuaFunction.c_str() );
|
||||||
|
|
||||||
|
m_pLuaTable->PushSelf( LUA->L );
|
||||||
|
|
||||||
|
lua_pushstring( LUA->L, "Name" );
|
||||||
|
lua_gettable( LUA->L, -2 );
|
||||||
|
const char *pStr = lua_tostring( LUA->L, -1 );
|
||||||
|
if( pStr == NULL )
|
||||||
|
RageException::Throw( "\"%s\" \"Name\" entry is not a string", sLuaFunction.c_str() );
|
||||||
|
defOut.name = pStr;
|
||||||
|
lua_pop( LUA->L, 1 );
|
||||||
|
|
||||||
|
|
||||||
|
lua_pushstring( LUA->L, "OneChoiceForAllPlayers" );
|
||||||
|
lua_gettable( LUA->L, -2 );
|
||||||
|
defOut.bOneChoiceForAllPlayers = !!lua_toboolean( LUA->L, -1 );
|
||||||
|
lua_pop( LUA->L, 1 );
|
||||||
|
|
||||||
|
|
||||||
|
lua_pushstring( LUA->L, "ExportOnChange" );
|
||||||
|
lua_gettable( LUA->L, -2 );
|
||||||
|
defOut.m_bExportOnChange = !!lua_toboolean( LUA->L, -1 );
|
||||||
|
lua_pop( LUA->L, 1 );
|
||||||
|
|
||||||
|
|
||||||
|
lua_pushstring( LUA->L, "LayoutType" );
|
||||||
|
lua_gettable( LUA->L, -2 );
|
||||||
|
pStr = lua_tostring( LUA->L, -1 );
|
||||||
|
if( pStr == NULL )
|
||||||
|
RageException::Throw( "\"%s\" \"LayoutType\" entry is not a string", sLuaFunction.c_str() );
|
||||||
|
defOut.layoutType = StringToLayoutType( pStr );
|
||||||
|
ASSERT( defOut.layoutType != LAYOUT_INVALID );
|
||||||
|
lua_pop( LUA->L, 1 );
|
||||||
|
|
||||||
|
|
||||||
|
lua_pushstring( LUA->L, "SelectType" );
|
||||||
|
lua_gettable( LUA->L, -2 );
|
||||||
|
pStr = lua_tostring( LUA->L, -1 );
|
||||||
|
if( pStr == NULL )
|
||||||
|
RageException::Throw( "\"%s\" \"SelectType\" entry is not a string", sLuaFunction.c_str() );
|
||||||
|
defOut.selectType = StringToSelectType( pStr );
|
||||||
|
ASSERT( defOut.selectType != SELECT_INVALID );
|
||||||
|
lua_pop( LUA->L, 1 );
|
||||||
|
|
||||||
|
|
||||||
|
/* Iterate over the "Choices" table. */
|
||||||
|
lua_pushstring( LUA->L, "Choices" );
|
||||||
|
lua_gettable( LUA->L, -2 );
|
||||||
|
if( !lua_istable( LUA->L, -1 ) )
|
||||||
|
RageException::Throw( "\"%s\" \"Choices\" is not a table", sLuaFunction.c_str() );
|
||||||
|
|
||||||
|
lua_pushnil( LUA->L );
|
||||||
|
while( lua_next(LUA->L, -2) != 0 )
|
||||||
{
|
{
|
||||||
m_pLuaTable->PushSelf( LUA->L );
|
/* `key' is at index -2 and `value' at index -1 */
|
||||||
|
const char *pValue = lua_tostring( LUA->L, -1 );
|
||||||
|
if( pValue == NULL )
|
||||||
|
RageException::Throw( "\"%s\" Column entry is not a string", sLuaFunction.c_str() );
|
||||||
|
// LOG->Trace( "'%s'", pValue);
|
||||||
|
|
||||||
lua_pushstring( LUA->L, "Name" );
|
defOut.choices.push_back( pValue );
|
||||||
lua_gettable( LUA->L, -2 );
|
|
||||||
const char *pStr = lua_tostring( LUA->L, -1 );
|
lua_pop( LUA->L, 1 ); /* removes `value'; keeps `key' for next iteration */
|
||||||
if( pStr == NULL )
|
}
|
||||||
RageException::Throw( "\"%s\" \"Name\" entry is not a string", sLuaFunction.c_str() );
|
|
||||||
defOut.name = pStr;
|
lua_pop( LUA->L, 1 ); /* pop choices table */
|
||||||
lua_pop( LUA->L, 1 );
|
|
||||||
|
|
||||||
|
|
||||||
lua_pushstring( LUA->L, "OneChoiceForAllPlayers" );
|
/* Iterate over the "EnabledForPlayers" table. */
|
||||||
lua_gettable( LUA->L, -2 );
|
lua_pushstring( LUA->L, "EnabledForPlayers" );
|
||||||
defOut.bOneChoiceForAllPlayers = !!lua_toboolean( LUA->L, -1 );
|
lua_gettable( LUA->L, -2 );
|
||||||
lua_pop( LUA->L, 1 );
|
if( !lua_isnil( LUA->L, -1 ) )
|
||||||
|
{
|
||||||
|
|
||||||
lua_pushstring( LUA->L, "ExportOnChange" );
|
|
||||||
lua_gettable( LUA->L, -2 );
|
|
||||||
defOut.m_bExportOnChange = !!lua_toboolean( LUA->L, -1 );
|
|
||||||
lua_pop( LUA->L, 1 );
|
|
||||||
|
|
||||||
|
|
||||||
lua_pushstring( LUA->L, "LayoutType" );
|
|
||||||
lua_gettable( LUA->L, -2 );
|
|
||||||
pStr = lua_tostring( LUA->L, -1 );
|
|
||||||
if( pStr == NULL )
|
|
||||||
RageException::Throw( "\"%s\" \"LayoutType\" entry is not a string", sLuaFunction.c_str() );
|
|
||||||
defOut.layoutType = StringToLayoutType( pStr );
|
|
||||||
ASSERT( defOut.layoutType != LAYOUT_INVALID );
|
|
||||||
lua_pop( LUA->L, 1 );
|
|
||||||
|
|
||||||
|
|
||||||
lua_pushstring( LUA->L, "SelectType" );
|
|
||||||
lua_gettable( LUA->L, -2 );
|
|
||||||
pStr = lua_tostring( LUA->L, -1 );
|
|
||||||
if( pStr == NULL )
|
|
||||||
RageException::Throw( "\"%s\" \"SelectType\" entry is not a string", sLuaFunction.c_str() );
|
|
||||||
defOut.selectType = StringToSelectType( pStr );
|
|
||||||
ASSERT( defOut.selectType != SELECT_INVALID );
|
|
||||||
lua_pop( LUA->L, 1 );
|
|
||||||
|
|
||||||
|
|
||||||
/* Iterate over the "Choices" table. */
|
|
||||||
lua_pushstring( LUA->L, "Choices" );
|
|
||||||
lua_gettable( LUA->L, -2 );
|
|
||||||
if( !lua_istable( LUA->L, -1 ) )
|
if( !lua_istable( LUA->L, -1 ) )
|
||||||
RageException::Throw( "\"%s\" \"Choices\" is not a table", sLuaFunction.c_str() );
|
RageException::Throw( "\"%s\" \"EnabledForPlayers\" is not a table", sLuaFunction.c_str() );
|
||||||
|
|
||||||
|
defOut.m_vEnabledForPlayers.clear(); // and fill in with supplied PlayerNumbers below
|
||||||
|
|
||||||
|
lua_pushnil( LUA->L );
|
||||||
|
while( lua_next(LUA->L, -2) != 0 )
|
||||||
|
{
|
||||||
|
/* `key' is at index -2 and `value' at index -1 */
|
||||||
|
PlayerNumber pn = (PlayerNumber)luaL_checkint( LUA->L, -1 );
|
||||||
|
|
||||||
|
defOut.m_vEnabledForPlayers.insert( pn );
|
||||||
|
|
||||||
|
lua_pop( LUA->L, 1 ); /* removes `value'; keeps `key' for next iteration */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
lua_pop( LUA->L, 1 ); /* pop EnabledForPlayers table */
|
||||||
|
|
||||||
|
|
||||||
|
/* Iterate over the "ReloadRowMessages" table. */
|
||||||
|
lua_pushstring( LUA->L, "ReloadRowMessages" );
|
||||||
|
lua_gettable( LUA->L, -2 );
|
||||||
|
if( !lua_isnil( LUA->L, -1 ) )
|
||||||
|
{
|
||||||
|
if( !lua_istable( LUA->L, -1 ) )
|
||||||
|
RageException::Throw( "\"%s\" \"ReloadRowMessages\" is not a table", sLuaFunction.c_str() );
|
||||||
|
|
||||||
lua_pushnil( LUA->L );
|
lua_pushnil( LUA->L );
|
||||||
while( lua_next(LUA->L, -2) != 0 )
|
while( lua_next(LUA->L, -2) != 0 )
|
||||||
@@ -557,192 +617,165 @@ public:
|
|||||||
const char *pValue = lua_tostring( LUA->L, -1 );
|
const char *pValue = lua_tostring( LUA->L, -1 );
|
||||||
if( pValue == NULL )
|
if( pValue == NULL )
|
||||||
RageException::Throw( "\"%s\" Column entry is not a string", sLuaFunction.c_str() );
|
RageException::Throw( "\"%s\" Column entry is not a string", sLuaFunction.c_str() );
|
||||||
// LOG->Trace( "'%s'", pValue);
|
LOG->Trace( "Found ReloadRowMessage '%s'", pValue);
|
||||||
|
|
||||||
defOut.choices.push_back( pValue );
|
m_vsReloadRowMessages.push_back( pValue );
|
||||||
|
|
||||||
lua_pop( LUA->L, 1 ); /* removes `value'; keeps `key' for next iteration */
|
lua_pop( LUA->L, 1 ); /* removes `value'; keeps `key' for next iteration */
|
||||||
}
|
}
|
||||||
|
}
|
||||||
lua_pop( LUA->L, 1 ); /* pop choices table */
|
lua_pop( LUA->L, 1 ); /* pop ReloadRowMessages table */
|
||||||
|
|
||||||
|
|
||||||
/* Iterate over the "EnabledForPlayers" table. */
|
/* Look for "ExportOnChange" value. */
|
||||||
lua_pushstring( LUA->L, "EnabledForPlayers" );
|
lua_pushstring( LUA->L, "ExportOnChange" );
|
||||||
lua_gettable( LUA->L, -2 );
|
lua_gettable( LUA->L, -2 );
|
||||||
if( !lua_isnil( LUA->L, -1 ) )
|
if( !lua_isnil( LUA->L, -1 ) )
|
||||||
|
{
|
||||||
|
defOut.m_bExportOnChange = !!MyLua_checkboolean( LUA->L, -1 );
|
||||||
|
}
|
||||||
|
lua_pop( LUA->L, 1 ); /* pop ExportOnChange value */
|
||||||
|
|
||||||
|
|
||||||
|
lua_pop( LUA->L, 1 ); /* pop main table */
|
||||||
|
ASSERT( lua_gettop(LUA->L) == 0 );
|
||||||
|
}
|
||||||
|
virtual void Reload( OptionRowDefinition &defOut )
|
||||||
|
{
|
||||||
|
/* Run the Lua expression. It should return a table. */
|
||||||
|
m_pLuaTable->SetFromExpression( m_sName );
|
||||||
|
|
||||||
|
if( m_pLuaTable->GetLuaType() != LUA_TTABLE )
|
||||||
|
RageException::Throw( "Result of \"%s\" is not a table", m_sName.c_str() );
|
||||||
|
|
||||||
|
m_pLuaTable->PushSelf( LUA->L );
|
||||||
|
|
||||||
|
|
||||||
|
/* Iterate over the "EnabledForPlayers" table. */
|
||||||
|
lua_pushstring( LUA->L, "EnabledForPlayers" );
|
||||||
|
lua_gettable( LUA->L, -2 );
|
||||||
|
if( !lua_isnil( LUA->L, -1 ) )
|
||||||
|
{
|
||||||
|
if( !lua_istable( LUA->L, -1 ) )
|
||||||
|
RageException::Throw( "\"%s\" \"EnabledForPlayers\" is not a table", m_sName.c_str() );
|
||||||
|
|
||||||
|
defOut.m_vEnabledForPlayers.clear(); // and fill in with supplied PlayerNumbers below
|
||||||
|
|
||||||
|
lua_pushnil( LUA->L );
|
||||||
|
while( lua_next(LUA->L, -2) != 0 )
|
||||||
{
|
{
|
||||||
if( !lua_istable( LUA->L, -1 ) )
|
/* `key' is at index -2 and `value' at index -1 */
|
||||||
RageException::Throw( "\"%s\" \"EnabledForPlayers\" is not a table", sLuaFunction.c_str() );
|
PlayerNumber pn = (PlayerNumber)luaL_checkint( LUA->L, -1 );
|
||||||
|
|
||||||
defOut.m_vEnabledForPlayers.clear(); // and fill in with supplied PlayerNumbers below
|
defOut.m_vEnabledForPlayers.insert( pn );
|
||||||
|
|
||||||
lua_pushnil( LUA->L );
|
lua_pop( LUA->L, 1 ); /* removes `value'; keeps `key' for next iteration */
|
||||||
while( lua_next(LUA->L, -2) != 0 )
|
|
||||||
{
|
|
||||||
/* `key' is at index -2 and `value' at index -1 */
|
|
||||||
PlayerNumber pn = (PlayerNumber)luaL_checkint( LUA->L, -1 );
|
|
||||||
|
|
||||||
defOut.m_vEnabledForPlayers.insert( pn );
|
|
||||||
|
|
||||||
lua_pop( LUA->L, 1 ); /* removes `value'; keeps `key' for next iteration */
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
lua_pop( LUA->L, 1 ); /* pop EnabledForPlayers table */
|
}
|
||||||
|
lua_pop( LUA->L, 1 ); /* pop EnabledForPlayers table */
|
||||||
|
|
||||||
|
|
||||||
/* Iterate over the "ReloadRowMessages" table. */
|
lua_pop( LUA->L, 1 ); /* pop main table */
|
||||||
lua_pushstring( LUA->L, "ReloadRowMessages" );
|
ASSERT( lua_gettop(LUA->L) == 0 );
|
||||||
|
}
|
||||||
|
virtual void ImportOption( const OptionRowDefinition &def, const vector<PlayerNumber> &vpns, vector<bool> vbSelectedOut[NUM_PLAYERS] ) const
|
||||||
|
{
|
||||||
|
ASSERT( lua_gettop(LUA->L) == 0 );
|
||||||
|
|
||||||
|
FOREACH_CONST( PlayerNumber, vpns, pn )
|
||||||
|
{
|
||||||
|
PlayerNumber p = *pn;
|
||||||
|
vector<bool> &vbSelOut = vbSelectedOut[p];
|
||||||
|
|
||||||
|
/* Evaluate the LoadSelections(self,array,pn) function, where array is a table
|
||||||
|
* representing vbSelectedOut. */
|
||||||
|
|
||||||
|
/* All selections default to false. */
|
||||||
|
for( unsigned i = 0; i < vbSelOut.size(); ++i )
|
||||||
|
vbSelOut[i] = false;
|
||||||
|
|
||||||
|
/* Create the vbSelectedOut table. */
|
||||||
|
LUA->CreateTableFromArrayB( vbSelOut );
|
||||||
|
ASSERT( lua_gettop(LUA->L) == 1 ); /* vbSelectedOut table */
|
||||||
|
|
||||||
|
/* Get the function to call from m_LuaTable. */
|
||||||
|
m_pLuaTable->PushSelf( LUA->L );
|
||||||
|
ASSERT( lua_istable( LUA->L, -1 ) );
|
||||||
|
|
||||||
|
lua_pushstring( LUA->L, "LoadSelections" );
|
||||||
lua_gettable( LUA->L, -2 );
|
lua_gettable( LUA->L, -2 );
|
||||||
if( !lua_isnil( LUA->L, -1 ) )
|
if( !lua_isfunction( LUA->L, -1 ) )
|
||||||
{
|
RageException::Throw( "\"%s\" \"LoadSelections\" entry is not a function", def.name.c_str() );
|
||||||
if( !lua_istable( LUA->L, -1 ) )
|
|
||||||
RageException::Throw( "\"%s\" \"ReloadRowMessages\" is not a table", sLuaFunction.c_str() );
|
|
||||||
|
|
||||||
lua_pushnil( LUA->L );
|
/* Argument 1 (self): */
|
||||||
while( lua_next(LUA->L, -2) != 0 )
|
m_pLuaTable->PushSelf( LUA->L );
|
||||||
{
|
|
||||||
/* `key' is at index -2 and `value' at index -1 */
|
|
||||||
const char *pValue = lua_tostring( LUA->L, -1 );
|
|
||||||
if( pValue == NULL )
|
|
||||||
RageException::Throw( "\"%s\" Column entry is not a string", sLuaFunction.c_str() );
|
|
||||||
LOG->Trace( "'%s'", pValue);
|
|
||||||
|
|
||||||
m_vsReloadRowMessages.push_back( pValue );
|
/* Argument 2 (vbSelectedOut): */
|
||||||
|
lua_pushvalue( LUA->L, 1 );
|
||||||
|
|
||||||
lua_pop( LUA->L, 1 ); /* removes `value'; keeps `key' for next iteration */
|
/* Argument 3 (pn): */
|
||||||
}
|
LuaHelpers::PushStack( (int) p );
|
||||||
}
|
|
||||||
lua_pop( LUA->L, 1 ); /* pop ReloadRowMessages table */
|
|
||||||
|
|
||||||
|
ASSERT( lua_gettop(LUA->L) == 6 ); /* vbSelectedOut, m_iLuaTable, function, self, arg, arg */
|
||||||
|
|
||||||
/* Look for "ExportOnChange" value. */
|
lua_call( LUA->L, 3, 0 ); // call function with 3 arguments and 0 results
|
||||||
lua_pushstring( LUA->L, "ExportOnChange" );
|
ASSERT( lua_gettop(LUA->L) == 2 );
|
||||||
lua_gettable( LUA->L, -2 );
|
|
||||||
if( !lua_isnil( LUA->L, -1 ) )
|
|
||||||
{
|
|
||||||
defOut.m_bExportOnChange = !!MyLua_checkboolean( LUA->L, -1 );
|
|
||||||
}
|
|
||||||
lua_pop( LUA->L, 1 ); /* pop ExportOnChange value */
|
|
||||||
|
|
||||||
|
lua_pop( LUA->L, 1 ); /* pop option table */
|
||||||
|
|
||||||
/* Iterate over the "ReloadRowMessages" table. */
|
LUA->ReadArrayFromTableB( vbSelOut );
|
||||||
lua_pushstring( LUA->L, "ReloadRowMessages" );
|
|
||||||
lua_gettable( LUA->L, -2 );
|
|
||||||
if( !lua_isnil( LUA->L, -1 ) )
|
|
||||||
{
|
|
||||||
if( !lua_istable( LUA->L, -1 ) )
|
|
||||||
RageException::Throw( "\"%s\" \"ReloadRowMessages\" is not a table", sLuaFunction.c_str() );
|
|
||||||
|
|
||||||
m_vsReloadRowMessages.clear(); // and fill in with supplied PlayerNumbers below
|
lua_pop( LUA->L, 1 ); /* pop vbSelectedOut table */
|
||||||
|
|
||||||
lua_pushnil( LUA->L );
|
|
||||||
while( lua_next(LUA->L, -2) != 0 )
|
|
||||||
{
|
|
||||||
/* `key' is at index -2 and `value' at index -1 */
|
|
||||||
const char *pValue = lua_tostring( LUA->L, -1 );
|
|
||||||
if( pValue == NULL )
|
|
||||||
RageException::Throw( "\"%s\" Column entry is not a string", sLuaFunction.c_str() );
|
|
||||||
LOG->Trace( "'%s'", pValue);
|
|
||||||
|
|
||||||
m_vsReloadRowMessages.push_back( pValue );
|
|
||||||
|
|
||||||
lua_pop( LUA->L, 1 ); /* removes `value'; keeps `key' for next iteration */
|
|
||||||
}
|
|
||||||
}
|
|
||||||
lua_pop( LUA->L, 1 ); /* pop ReloadRowMessages table */
|
|
||||||
|
|
||||||
|
|
||||||
lua_pop( LUA->L, 1 ); /* pop main table */
|
|
||||||
ASSERT( lua_gettop(LUA->L) == 0 );
|
ASSERT( lua_gettop(LUA->L) == 0 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void ImportOption( const OptionRowDefinition &def, PlayerNumber pn, vector<bool> &vbSelectedOut ) const
|
virtual int ExportOption( const OptionRowDefinition &def, const vector<PlayerNumber> &vpns, const vector<bool> vbSelected[NUM_PLAYERS] ) const
|
||||||
{
|
{
|
||||||
ASSERT( lua_gettop(LUA->L) == 0 );
|
ASSERT( lua_gettop(LUA->L) == 0 );
|
||||||
|
|
||||||
/* Evaluate the LoadSelections(self,array,pn) function, where array is a table
|
FOREACH_CONST( PlayerNumber, vpns, pn )
|
||||||
* representing vbSelectedOut. */
|
{
|
||||||
|
PlayerNumber p = *pn;
|
||||||
|
const vector<bool> &vbSel = vbSelected[p];
|
||||||
|
|
||||||
/* All selections default to false. */
|
/* Evaluate SaveSelections(self,array,pn) function, where array is a table
|
||||||
for( unsigned i = 0; i < vbSelectedOut.size(); ++i )
|
* representing vbSelectedOut. */
|
||||||
vbSelectedOut[i] = false;
|
|
||||||
|
|
||||||
/* Create the vbSelectedOut table. */
|
vector<bool> vbSelectedCopy = vbSel;
|
||||||
LUA->CreateTableFromArrayB( vbSelectedOut );
|
|
||||||
ASSERT( lua_gettop(LUA->L) == 1 ); /* vbSelectedOut table */
|
|
||||||
|
|
||||||
/* Get the function to call from m_LuaTable. */
|
/* Create the vbSelectedOut table. */
|
||||||
m_pLuaTable->PushSelf( LUA->L );
|
LUA->CreateTableFromArrayB( vbSelectedCopy );
|
||||||
ASSERT( lua_istable( LUA->L, -1 ) );
|
ASSERT( lua_gettop(LUA->L) == 1 ); /* vbSelectedOut table */
|
||||||
|
|
||||||
lua_pushstring( LUA->L, "LoadSelections" );
|
/* Get the function to call. */
|
||||||
lua_gettable( LUA->L, -2 );
|
m_pLuaTable->PushSelf( LUA->L );
|
||||||
if( !lua_isfunction( LUA->L, -1 ) )
|
ASSERT( lua_istable( LUA->L, -1 ) );
|
||||||
RageException::Throw( "\"%s\" \"LoadSelections\" entry is not a function", def.name.c_str() );
|
|
||||||
|
|
||||||
/* Argument 1 (self): */
|
lua_pushstring( LUA->L, "SaveSelections" );
|
||||||
m_pLuaTable->PushSelf( LUA->L );
|
lua_gettable( LUA->L, -2 );
|
||||||
|
if( !lua_isfunction( LUA->L, -1 ) )
|
||||||
|
RageException::Throw( "\"%s\" \"SaveSelections\" entry is not a function", def.name.c_str() );
|
||||||
|
|
||||||
/* Argument 2 (vbSelectedOut): */
|
/* Argument 1 (self): */
|
||||||
lua_pushvalue( LUA->L, 1 );
|
m_pLuaTable->PushSelf( LUA->L );
|
||||||
|
|
||||||
/* Argument 3 (pn): */
|
/* Argument 2 (vbSelectedOut): */
|
||||||
LuaHelpers::PushStack( (int) pn );
|
lua_pushvalue( LUA->L, 1 );
|
||||||
|
|
||||||
ASSERT( lua_gettop(LUA->L) == 6 ); /* vbSelectedOut, m_iLuaTable, function, self, arg, arg */
|
/* Argument 3 (pn): */
|
||||||
|
LuaHelpers::PushStack( (int) p );
|
||||||
|
|
||||||
lua_call( LUA->L, 3, 0 ); // call function with 3 arguments and 0 results
|
ASSERT( lua_gettop(LUA->L) == 6 ); /* vbSelectedOut, m_iLuaTable, function, self, arg, arg */
|
||||||
ASSERT( lua_gettop(LUA->L) == 2 );
|
|
||||||
|
|
||||||
lua_pop( LUA->L, 1 ); /* pop option table */
|
lua_call( LUA->L, 3, 0 ); // call function with 3 arguments and 0 results
|
||||||
|
ASSERT( lua_gettop(LUA->L) == 2 );
|
||||||
|
|
||||||
LUA->ReadArrayFromTableB( vbSelectedOut );
|
lua_pop( LUA->L, 1 ); /* pop option table */
|
||||||
|
lua_pop( LUA->L, 1 ); /* pop vbSelected table */
|
||||||
|
|
||||||
lua_pop( LUA->L, 1 ); /* pop vbSelectedOut table */
|
ASSERT( lua_gettop(LUA->L) == 0 );
|
||||||
|
}
|
||||||
ASSERT( lua_gettop(LUA->L) == 0 );
|
|
||||||
}
|
|
||||||
virtual int ExportOption( const OptionRowDefinition &def, PlayerNumber pn, const vector<bool> &vbSelected ) const
|
|
||||||
{
|
|
||||||
ASSERT( lua_gettop(LUA->L) == 0 );
|
|
||||||
|
|
||||||
/* Evaluate SaveSelections(self,array,pn) function, where array is a table
|
|
||||||
* representing vbSelectedOut. */
|
|
||||||
|
|
||||||
vector<bool> vbSelectedCopy = vbSelected;
|
|
||||||
|
|
||||||
/* Create the vbSelectedOut table. */
|
|
||||||
LUA->CreateTableFromArrayB( vbSelectedCopy );
|
|
||||||
ASSERT( lua_gettop(LUA->L) == 1 ); /* vbSelectedOut table */
|
|
||||||
|
|
||||||
/* Get the function to call. */
|
|
||||||
m_pLuaTable->PushSelf( LUA->L );
|
|
||||||
ASSERT( lua_istable( LUA->L, -1 ) );
|
|
||||||
|
|
||||||
lua_pushstring( LUA->L, "SaveSelections" );
|
|
||||||
lua_gettable( LUA->L, -2 );
|
|
||||||
if( !lua_isfunction( LUA->L, -1 ) )
|
|
||||||
RageException::Throw( "\"%s\" \"SaveSelections\" entry is not a function", def.name.c_str() );
|
|
||||||
|
|
||||||
/* Argument 1 (self): */
|
|
||||||
m_pLuaTable->PushSelf( LUA->L );
|
|
||||||
|
|
||||||
/* Argument 2 (vbSelectedOut): */
|
|
||||||
lua_pushvalue( LUA->L, 1 );
|
|
||||||
|
|
||||||
/* Argument 3 (pn): */
|
|
||||||
LuaHelpers::PushStack( (int) pn );
|
|
||||||
|
|
||||||
ASSERT( lua_gettop(LUA->L) == 6 ); /* vbSelectedOut, m_iLuaTable, function, self, arg, arg */
|
|
||||||
|
|
||||||
lua_call( LUA->L, 3, 0 ); // call function with 3 arguments and 0 results
|
|
||||||
ASSERT( lua_gettop(LUA->L) == 2 );
|
|
||||||
|
|
||||||
lua_pop( LUA->L, 1 ); /* pop option table */
|
|
||||||
lua_pop( LUA->L, 1 ); /* pop vbSelected table */
|
|
||||||
|
|
||||||
ASSERT( lua_gettop(LUA->L) == 0 );
|
|
||||||
|
|
||||||
// XXX: allow specifying the mask
|
// XXX: allow specifying the mask
|
||||||
return 0;
|
return 0;
|
||||||
@@ -781,29 +814,43 @@ public:
|
|||||||
|
|
||||||
defOut.name = opt->name;
|
defOut.name = opt->name;
|
||||||
}
|
}
|
||||||
virtual void ImportOption( const OptionRowDefinition &def, PlayerNumber pn, vector<bool> &vbSelectedOut ) const
|
virtual void ImportOption( const OptionRowDefinition &def, const vector<PlayerNumber> &vpns, vector<bool> vbSelectedOut[NUM_PLAYERS] ) const
|
||||||
{
|
{
|
||||||
int iSelection = opt->Get();
|
FOREACH_CONST( PlayerNumber, vpns, pn )
|
||||||
SelectExactlyOne( iSelection, vbSelectedOut );
|
{
|
||||||
|
PlayerNumber p = *pn;
|
||||||
|
vector<bool> &vbSelOut = vbSelectedOut[p];
|
||||||
|
|
||||||
|
int iSelection = opt->Get();
|
||||||
|
SelectExactlyOne( iSelection, vbSelOut );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
virtual int ExportOption( const OptionRowDefinition &def, PlayerNumber pn, const vector<bool> &vbSelected ) const
|
virtual int ExportOption( const OptionRowDefinition &def, const vector<PlayerNumber> &vpns, const vector<bool> vbSelected[NUM_PLAYERS] ) const
|
||||||
{
|
{
|
||||||
int sel = GetOneSelection(vbSelected);
|
bool bChanged = false;
|
||||||
|
|
||||||
/* Get the original choice. */
|
FOREACH_CONST( PlayerNumber, vpns, pn )
|
||||||
int Original = opt->Get();
|
{
|
||||||
|
PlayerNumber p = *pn;
|
||||||
|
const vector<bool> &vbSel = vbSelected[p];
|
||||||
|
|
||||||
/* Apply. */
|
int sel = GetOneSelection(vbSel);
|
||||||
opt->Put( sel );
|
|
||||||
|
|
||||||
/* Get the new choice. */
|
/* Get the original choice. */
|
||||||
int New = opt->Get();
|
int Original = opt->Get();
|
||||||
|
|
||||||
/* If it didn't change, don't return any side-effects. */
|
/* Apply. */
|
||||||
if( Original == New )
|
opt->Put( sel );
|
||||||
return 0;
|
|
||||||
|
|
||||||
return opt->GetEffects();
|
/* Get the new choice. */
|
||||||
|
int New = opt->Get();
|
||||||
|
|
||||||
|
/* If it didn't change, don't return any side-effects. */
|
||||||
|
if( Original != New )
|
||||||
|
bChanged = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return bChanged ? opt->GetEffects() : 0;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -864,25 +911,38 @@ public:
|
|||||||
if( *m_pstToFill == STEPS_TYPE_INVALID )
|
if( *m_pstToFill == STEPS_TYPE_INVALID )
|
||||||
m_pstToFill->Set( m_vStepsTypesToShow[0] );
|
m_pstToFill->Set( m_vStepsTypesToShow[0] );
|
||||||
}
|
}
|
||||||
virtual void ImportOption( const OptionRowDefinition &def, PlayerNumber pn, vector<bool> &vbSelectedOut ) const
|
virtual void ImportOption( const OptionRowDefinition &def, const vector<PlayerNumber> &vpns, vector<bool> vbSelectedOut[NUM_PLAYERS] ) const
|
||||||
{
|
{
|
||||||
if( GAMESTATE->m_pCurSteps[0] )
|
FOREACH_CONST( PlayerNumber, vpns, pn )
|
||||||
{
|
{
|
||||||
StepsType st = GAMESTATE->m_pCurSteps[0]->m_StepsType;
|
PlayerNumber p = *pn;
|
||||||
vector<StepsType>::const_iterator iter = find( m_vStepsTypesToShow.begin(), m_vStepsTypesToShow.end(), st );
|
vector<bool> &vbSelOut = vbSelectedOut[p];
|
||||||
if( iter != m_vStepsTypesToShow.end() )
|
|
||||||
|
if( GAMESTATE->m_pCurSteps[0] )
|
||||||
{
|
{
|
||||||
unsigned i = iter - m_vStepsTypesToShow.begin();
|
StepsType st = GAMESTATE->m_pCurSteps[0]->m_StepsType;
|
||||||
vbSelectedOut[i] = true;
|
vector<StepsType>::const_iterator iter = find( m_vStepsTypesToShow.begin(), m_vStepsTypesToShow.end(), st );
|
||||||
return;
|
if( iter != m_vStepsTypesToShow.end() )
|
||||||
|
{
|
||||||
|
unsigned i = iter - m_vStepsTypesToShow.begin();
|
||||||
|
vbSelOut[i] = true;
|
||||||
|
continue; // done with this player
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
vbSelOut[0] = true;
|
||||||
}
|
}
|
||||||
vbSelectedOut[0] = true;
|
|
||||||
}
|
}
|
||||||
virtual int ExportOption( const OptionRowDefinition &def, PlayerNumber pn, const vector<bool> &vbSelected ) const
|
virtual int ExportOption( const OptionRowDefinition &def, const vector<PlayerNumber> &vpns, const vector<bool> vbSelected[NUM_PLAYERS] ) const
|
||||||
{
|
{
|
||||||
int index = GetOneSelection( vbSelected );
|
FOREACH_CONST( PlayerNumber, vpns, pn )
|
||||||
m_pstToFill->Set( m_vStepsTypesToShow[index] );
|
{
|
||||||
|
PlayerNumber p = *pn;
|
||||||
|
const vector<bool> &vbSel = vbSelected[p];
|
||||||
|
|
||||||
|
int index = GetOneSelection( vbSel );
|
||||||
|
m_pstToFill->Set( m_vStepsTypesToShow[index] );
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -992,43 +1052,58 @@ public:
|
|||||||
m_pDifficultyToFill->Set( m_vDifficulties[0] );
|
m_pDifficultyToFill->Set( m_vDifficulties[0] );
|
||||||
m_ppStepsToFill->Set( m_vSteps[0] );
|
m_ppStepsToFill->Set( m_vSteps[0] );
|
||||||
}
|
}
|
||||||
virtual void ImportOption( const OptionRowDefinition &def, PlayerNumber pn, vector<bool> &vbSelectedOut ) const
|
virtual void ImportOption( const OptionRowDefinition &def, const vector<PlayerNumber> &vpns, vector<bool> vbSelectedOut[NUM_PLAYERS] ) const
|
||||||
{
|
{
|
||||||
ASSERT( m_vSteps.size() == vbSelectedOut.size() );
|
FOREACH_CONST( PlayerNumber, vpns, pn )
|
||||||
|
{
|
||||||
|
PlayerNumber p = *pn;
|
||||||
|
vector<bool> &vbSelOut = vbSelectedOut[p];
|
||||||
|
|
||||||
// look for matching steps
|
ASSERT( m_vSteps.size() == vbSelOut.size() );
|
||||||
vector<Steps*>::const_iterator iter = find( m_vSteps.begin(), m_vSteps.end(), m_ppStepsToFill->Get() );
|
|
||||||
if( iter != m_vSteps.end() )
|
// look for matching steps
|
||||||
{
|
vector<Steps*>::const_iterator iter = find( m_vSteps.begin(), m_vSteps.end(), m_ppStepsToFill->Get() );
|
||||||
unsigned i = iter - m_vSteps.begin();
|
if( iter != m_vSteps.end() )
|
||||||
vbSelectedOut[i] = true;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// look for matching difficulty
|
|
||||||
if( m_pDifficultyToFill )
|
|
||||||
{
|
|
||||||
FOREACH_CONST( Difficulty, m_vDifficulties, d )
|
|
||||||
{
|
{
|
||||||
unsigned i = d - m_vDifficulties.begin();
|
unsigned i = iter - m_vSteps.begin();
|
||||||
if( *d == GAMESTATE->m_PreferredDifficulty[0] )
|
vbSelOut[i] = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// look for matching difficulty
|
||||||
|
if( m_pDifficultyToFill )
|
||||||
|
{
|
||||||
|
FOREACH_CONST( Difficulty, m_vDifficulties, d )
|
||||||
{
|
{
|
||||||
vbSelectedOut[i] = true;
|
unsigned i = d - m_vDifficulties.begin();
|
||||||
ExportOption( def, pn, vbSelectedOut ); // current steps changed
|
if( *d == GAMESTATE->m_PreferredDifficulty[0] )
|
||||||
return;
|
{
|
||||||
|
vbSelOut[i] = true;
|
||||||
|
vector<PlayerNumber> v;
|
||||||
|
v.push_back( p );
|
||||||
|
ExportOption( def, v, vbSelectedOut ); // current steps changed
|
||||||
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// default to 1st
|
||||||
|
vbSelOut[0] = true;
|
||||||
}
|
}
|
||||||
// default to 1st
|
|
||||||
vbSelectedOut[0] = true;
|
|
||||||
}
|
}
|
||||||
virtual int ExportOption( const OptionRowDefinition &def, PlayerNumber pn, const vector<bool> &vbSelected ) const
|
virtual int ExportOption( const OptionRowDefinition &def, const vector<PlayerNumber> &vpns, const vector<bool> vbSelected[NUM_PLAYERS] ) const
|
||||||
{
|
{
|
||||||
int index = GetOneSelection( vbSelected );
|
FOREACH_CONST( PlayerNumber, vpns, pn )
|
||||||
Difficulty dc = m_vDifficulties[index];
|
{
|
||||||
Steps *pSteps = m_vSteps[index];
|
PlayerNumber p = *pn;
|
||||||
if( m_pDifficultyToFill )
|
const vector<bool> &vbSel = vbSelected[p];
|
||||||
m_pDifficultyToFill->Set( dc );
|
|
||||||
m_ppStepsToFill->Set( pSteps );
|
int index = GetOneSelection( vbSel );
|
||||||
|
Difficulty dc = m_vDifficulties[index];
|
||||||
|
Steps *pSteps = m_vSteps[index];
|
||||||
|
if( m_pDifficultyToFill )
|
||||||
|
m_pDifficultyToFill->Set( dc );
|
||||||
|
m_ppStepsToFill->Set( pSteps );
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -23,10 +23,10 @@ public:
|
|||||||
m_vsReloadRowMessages.clear();
|
m_vsReloadRowMessages.clear();
|
||||||
}
|
}
|
||||||
virtual void Load( OptionRowDefinition &defOut, CString sParam ) = 0;
|
virtual void Load( OptionRowDefinition &defOut, CString sParam ) = 0;
|
||||||
void Reload( OptionRowDefinition &defOut ) { this->Load(defOut,m_sName); }
|
virtual void Reload( OptionRowDefinition &defOut ) { this->Load(defOut,m_sName); }
|
||||||
virtual void ImportOption( const OptionRowDefinition &row, PlayerNumber pn, vector<bool> &vbSelectedOut ) const = 0;
|
virtual void ImportOption( const OptionRowDefinition &row, const vector<PlayerNumber> &vpns, vector<bool> vbSelectedOut[NUM_PLAYERS] ) const = 0;
|
||||||
/* Returns an OPT mask. */
|
/* Returns an OPT mask. */
|
||||||
virtual int ExportOption( const OptionRowDefinition &def, PlayerNumber pn, const vector<bool> &vbSelected ) const = 0;
|
virtual int ExportOption( const OptionRowDefinition &def, const vector<PlayerNumber> &vpns, const vector<bool> vbSelected[NUM_PLAYERS] ) const = 0;
|
||||||
virtual CString GetIconText( const OptionRowDefinition &def, int iFirstSelection ) const { return ""; }
|
virtual CString GetIconText( const OptionRowDefinition &def, int iFirstSelection ) const { return ""; }
|
||||||
virtual bool HasScreen( int iChoice ) const { return false; }
|
virtual bool HasScreen( int iChoice ) const { return false; }
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ void ScreenMiniMenu::Init( const Menu* pDef, ScreenMessage SM_SendOnOK, ScreenMe
|
|||||||
ScreenOptions::InitMenu( INPUTMODE_SHARE_CURSOR, vDefs, vHands );
|
ScreenOptions::InitMenu( INPUTMODE_SHARE_CURSOR, vDefs, vHands );
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScreenMiniMenu::ImportOptions( int r, PlayerNumber pn )
|
void ScreenMiniMenu::ImportOptions( int r, const vector<PlayerNumber> &vpns )
|
||||||
{
|
{
|
||||||
OptionRow &optrow = *m_Rows[r];
|
OptionRow &optrow = *m_Rows[r];
|
||||||
MenuRow &mr = m_vMenuRows[r];
|
MenuRow &mr = m_vMenuRows[r];
|
||||||
@@ -94,7 +94,7 @@ void ScreenMiniMenu::ImportOptions( int r, PlayerNumber pn )
|
|||||||
optrow.SetOneSharedSelection( mr.iDefaultChoice );
|
optrow.SetOneSharedSelection( mr.iDefaultChoice );
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScreenMiniMenu::ExportOptions( int r, PlayerNumber pn )
|
void ScreenMiniMenu::ExportOptions( int r, const vector<PlayerNumber> &vpns )
|
||||||
{
|
{
|
||||||
if( r == GetCurrentRow() )
|
if( r == GetCurrentRow() )
|
||||||
s_iLastRowCode = m_vMenuRows[r].iRowCode;
|
s_iLastRowCode = m_vMenuRows[r].iRowCode;
|
||||||
|
|||||||
@@ -58,8 +58,8 @@ public:
|
|||||||
ScreenMiniMenu( CString sScreenClass );
|
ScreenMiniMenu( CString sScreenClass );
|
||||||
void Init( const Menu* pDef, ScreenMessage SM_SendOnOK, ScreenMessage SM_SendOnCancel );
|
void Init( const Menu* pDef, ScreenMessage SM_SendOnOK, ScreenMessage SM_SendOnCancel );
|
||||||
protected:
|
protected:
|
||||||
virtual void ImportOptions( int row, PlayerNumber pn );
|
virtual void ImportOptions( int row, const vector<PlayerNumber> &vpns );
|
||||||
virtual void ExportOptions( int row, PlayerNumber pn );
|
virtual void ExportOptions( int row, const vector<PlayerNumber> &vpns );
|
||||||
|
|
||||||
virtual void GoToNextScreen();
|
virtual void GoToNextScreen();
|
||||||
virtual void GoToPrevScreen();
|
virtual void GoToPrevScreen();
|
||||||
|
|||||||
@@ -154,8 +154,8 @@ void ScreenNetworkOptions::MenuStart( PlayerNumber pn, const InputEventType type
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScreenNetworkOptions::ImportOptions( int row, PlayerNumber pn ) { }
|
void ScreenNetworkOptions::ImportOptions( int row, const vector<PlayerNumber> &vpns ) { }
|
||||||
void ScreenNetworkOptions::ExportOptions( int row, PlayerNumber pn ) { }
|
void ScreenNetworkOptions::ExportOptions( int row, const vector<PlayerNumber> &vpns ) { }
|
||||||
|
|
||||||
void ScreenNetworkOptions::UpdateConnectStatus( )
|
void ScreenNetworkOptions::UpdateConnectStatus( )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -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( int row, PlayerNumber pn );
|
void ImportOptions( int row, const vector<PlayerNumber> &vpns );
|
||||||
void ExportOptions( int row, PlayerNumber pn );
|
void ExportOptions( int row, const vector<PlayerNumber> &vpns );
|
||||||
|
|
||||||
void GoToNextScreen();
|
void GoToNextScreen();
|
||||||
void GoToPrevScreen();
|
void GoToPrevScreen();
|
||||||
|
|||||||
@@ -154,8 +154,10 @@ void ScreenOptions::InitMenu( InputMode im, const vector<OptionRowDefinition> &v
|
|||||||
row.LoadMetrics( m_sName );
|
row.LoadMetrics( m_sName );
|
||||||
row.LoadNormal( def, hand, bFirstRowGoesDown );
|
row.LoadNormal( def, hand, bFirstRowGoesDown );
|
||||||
|
|
||||||
|
vector<PlayerNumber> vpns;
|
||||||
FOREACH_HumanPlayer( p )
|
FOREACH_HumanPlayer( p )
|
||||||
this->ImportOptions( r, p );
|
vpns.push_back( p );
|
||||||
|
this->ImportOptions( r, vpns );
|
||||||
|
|
||||||
CHECKPOINT_M( ssprintf("row %i: %s", r, row.GetRowDef().name.c_str()) );
|
CHECKPOINT_M( ssprintf("row %i: %s", r, row.GetRowDef().name.c_str()) );
|
||||||
|
|
||||||
@@ -511,8 +513,12 @@ void ScreenOptions::HandleScreenMessage( const ScreenMessage SM )
|
|||||||
break;
|
break;
|
||||||
case SM_GoToNextScreen:
|
case SM_GoToNextScreen:
|
||||||
for( unsigned r=0; r<m_Rows.size(); r++ ) // foreach row
|
for( unsigned r=0; r<m_Rows.size(); r++ ) // foreach row
|
||||||
|
{
|
||||||
|
vector<PlayerNumber> vpns;
|
||||||
FOREACH_HumanPlayer( p )
|
FOREACH_HumanPlayer( p )
|
||||||
this->ExportOptions( r, p );
|
vpns.push_back( p );
|
||||||
|
this->ExportOptions( r, vpns );
|
||||||
|
}
|
||||||
this->GoToNextScreen();
|
this->GoToNextScreen();
|
||||||
break;
|
break;
|
||||||
case SM_BeginFadingOut:
|
case SM_BeginFadingOut:
|
||||||
@@ -999,8 +1005,12 @@ void ScreenOptions::ChangeValueInRow( PlayerNumber pn, int iDelta, bool Repeat )
|
|||||||
m_SoundChangeCol.Play();
|
m_SoundChangeCol.Play();
|
||||||
|
|
||||||
if( row.GetRowDef().m_bExportOnChange )
|
if( row.GetRowDef().m_bExportOnChange )
|
||||||
|
{
|
||||||
|
vector<PlayerNumber> vpns;
|
||||||
FOREACH_HumanPlayer( p )
|
FOREACH_HumanPlayer( p )
|
||||||
ExportOptions( iCurRow, p );
|
vpns.push_back( p );
|
||||||
|
ExportOptions( iCurRow, vpns );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -34,8 +34,8 @@ public:
|
|||||||
virtual void HandleScreenMessage( const ScreenMessage SM );
|
virtual void HandleScreenMessage( const ScreenMessage SM );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void ImportOptions( int row, PlayerNumber pn ) = 0;
|
virtual void ImportOptions( int row, const vector<PlayerNumber> &vpns ) = 0;
|
||||||
virtual void ExportOptions( int row, PlayerNumber pn ) = 0;
|
virtual void ExportOptions( int row, const vector<PlayerNumber> &vpns ) = 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 );
|
||||||
|
|||||||
@@ -105,18 +105,22 @@ ScreenOptionsMaster::~ScreenOptionsMaster()
|
|||||||
OptionRowHandlers.clear();
|
OptionRowHandlers.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScreenOptionsMaster::ImportOptions( int r, PlayerNumber pn )
|
void ScreenOptionsMaster::ImportOptions( int r, const vector<PlayerNumber> &vpns )
|
||||||
{
|
{
|
||||||
ASSERT( GAMESTATE->IsHumanPlayer(pn) );
|
FOREACH_CONST( PlayerNumber, vpns, pn )
|
||||||
|
ASSERT( GAMESTATE->IsHumanPlayer(*pn) );
|
||||||
OptionRow &row = *m_Rows[r];
|
OptionRow &row = *m_Rows[r];
|
||||||
row.ImportOptions( pn );
|
row.ImportOptions( vpns );
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScreenOptionsMaster::ExportOptions( int r, PlayerNumber pn )
|
void ScreenOptionsMaster::ExportOptions( int r, const vector<PlayerNumber> &vpns )
|
||||||
{
|
{
|
||||||
OptionRow &row = *m_Rows[r];
|
OptionRow &row = *m_Rows[r];
|
||||||
bool bRowHasFocus = m_iCurrentRow[pn] == r;
|
bool bRowHasFocus[NUM_PLAYERS];
|
||||||
m_iChangeMask |= row.ExportOptions( pn, bRowHasFocus );
|
ZERO( bRowHasFocus );
|
||||||
|
FOREACH_CONST( PlayerNumber, vpns, pn )
|
||||||
|
bRowHasFocus[*pn] = m_iCurrentRow[*pn] == r;
|
||||||
|
m_iChangeMask |= row.ExportOptions( vpns, bRowHasFocus );
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScreenOptionsMaster::BeginFadingOut()
|
void ScreenOptionsMaster::BeginFadingOut()
|
||||||
@@ -216,8 +220,10 @@ void ScreenOptionsMaster::HandleScreenMessage( const ScreenMessage SM )
|
|||||||
{
|
{
|
||||||
CHECKPOINT_M( ssprintf("%i/%i", r, int(OptionRowHandlers.size())) );
|
CHECKPOINT_M( ssprintf("%i/%i", r, int(OptionRowHandlers.size())) );
|
||||||
|
|
||||||
|
vector<PlayerNumber> vpns;
|
||||||
FOREACH_OptionsPlayer( p )
|
FOREACH_OptionsPlayer( p )
|
||||||
ExportOptions( r, p );
|
vpns.push_back( p );
|
||||||
|
ExportOptions( r, vpns );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( m_iChangeMask & OPT_APPLY_ASPECT_RATIO )
|
if( m_iChangeMask & OPT_APPLY_ASPECT_RATIO )
|
||||||
|
|||||||
@@ -21,8 +21,8 @@ protected:
|
|||||||
protected:
|
protected:
|
||||||
void HandleScreenMessage( const ScreenMessage SM );
|
void HandleScreenMessage( const ScreenMessage SM );
|
||||||
|
|
||||||
virtual void ImportOptions( int row, PlayerNumber pn );
|
virtual void ImportOptions( int row, const vector<PlayerNumber> &vpns );
|
||||||
virtual void ExportOptions( int row, PlayerNumber pn );
|
virtual void ExportOptions( int row, const vector<PlayerNumber> &vpns );
|
||||||
|
|
||||||
virtual void BeginFadingOut();
|
virtual void BeginFadingOut();
|
||||||
virtual void GoToNextScreen();
|
virtual void GoToNextScreen();
|
||||||
|
|||||||
@@ -150,7 +150,9 @@ void ScreenPlayerOptions::Input( const DeviceInput& DeviceI, const InputEventTyp
|
|||||||
|
|
||||||
for( unsigned r=0; r<m_Rows.size(); r++ )
|
for( unsigned r=0; r<m_Rows.size(); r++ )
|
||||||
{
|
{
|
||||||
this->ImportOptions( r, pn );
|
vector<PlayerNumber> v;
|
||||||
|
v.push_back( pn );
|
||||||
|
this->ImportOptions( r, v );
|
||||||
this->PositionUnderlines( r, pn );
|
this->PositionUnderlines( r, pn );
|
||||||
this->UpdateDisqualified( r, pn );
|
this->UpdateDisqualified( r, pn );
|
||||||
}
|
}
|
||||||
@@ -205,7 +207,9 @@ void ScreenPlayerOptions::UpdateDisqualified( int row, PlayerNumber pn )
|
|||||||
// Find out if the current row when exprorted causes disqualification.
|
// Find out if the current row when exprorted causes disqualification.
|
||||||
// Exporting the row will fill GAMESTATE->m_PlayerOptions.
|
// Exporting the row will fill GAMESTATE->m_PlayerOptions.
|
||||||
GAMESTATE->m_pPlayerState[pn]->m_PlayerOptions = PlayerOptions();
|
GAMESTATE->m_pPlayerState[pn]->m_PlayerOptions = PlayerOptions();
|
||||||
ExportOptions( row, pn );
|
vector<PlayerNumber> v;
|
||||||
|
v.push_back( pn );
|
||||||
|
ExportOptions( row, v );
|
||||||
bool bRowCausesDisqualified = GAMESTATE->IsDisqualified( pn );
|
bool bRowCausesDisqualified = GAMESTATE->IsDisqualified( pn );
|
||||||
m_bRowCausesDisqualified[pn][row] = bRowCausesDisqualified;
|
m_bRowCausesDisqualified[pn][row] = bRowCausesDisqualified;
|
||||||
|
|
||||||
|
|||||||
@@ -84,12 +84,8 @@ void ScreenProfileOptions::Init()
|
|||||||
SOUND->PlayMusic( THEME->GetPathS("ScreenMachineOptions","music") );
|
SOUND->PlayMusic( THEME->GetPathS("ScreenMachineOptions","music") );
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScreenProfileOptions::ImportOptions( int row, PlayerNumber pn )
|
void ScreenProfileOptions::ImportOptions( int row, const vector<PlayerNumber> &vpns )
|
||||||
{
|
{
|
||||||
// Only take action for the master player
|
|
||||||
if( pn != GAMESTATE->m_MasterPlayerNumber )
|
|
||||||
return;
|
|
||||||
|
|
||||||
switch( row )
|
switch( row )
|
||||||
{
|
{
|
||||||
case PO_PLAYER1:
|
case PO_PLAYER1:
|
||||||
@@ -110,12 +106,8 @@ void ScreenProfileOptions::ImportOptions( int row, PlayerNumber pn )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScreenProfileOptions::ExportOptions( int row, PlayerNumber pn )
|
void ScreenProfileOptions::ExportOptions( int row, const vector<PlayerNumber> &vpns )
|
||||||
{
|
{
|
||||||
// Only take action for the master player
|
|
||||||
if( pn != GAMESTATE->m_MasterPlayerNumber )
|
|
||||||
return;
|
|
||||||
|
|
||||||
switch( row )
|
switch( row )
|
||||||
{
|
{
|
||||||
case PO_PLAYER1:
|
case PO_PLAYER1:
|
||||||
|
|||||||
@@ -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( int row, PlayerNumber pn );
|
void ImportOptions( int row, const vector<PlayerNumber> &vpns );
|
||||||
void ExportOptions( int row, PlayerNumber pn );
|
void ExportOptions( int row, const vector<PlayerNumber> &vpns );
|
||||||
|
|
||||||
void GoToNextScreen();
|
void GoToNextScreen();
|
||||||
void GoToPrevScreen();
|
void GoToPrevScreen();
|
||||||
|
|||||||
@@ -58,12 +58,8 @@ void ScreenSMOnlineLogin::Init()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScreenSMOnlineLogin::ImportOptions( int row, PlayerNumber pn )
|
void ScreenSMOnlineLogin::ImportOptions( int row, const vector<PlayerNumber> &vpns )
|
||||||
{
|
{
|
||||||
// Only take action for the master player
|
|
||||||
if( pn != GAMESTATE->m_MasterPlayerNumber )
|
|
||||||
return;
|
|
||||||
|
|
||||||
switch( row )
|
switch( row )
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
@@ -84,12 +80,8 @@ void ScreenSMOnlineLogin::ImportOptions( int row, PlayerNumber pn )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScreenSMOnlineLogin::ExportOptions( int row, PlayerNumber pn )
|
void ScreenSMOnlineLogin::ExportOptions( int row, const vector<PlayerNumber> &vpns )
|
||||||
{
|
{
|
||||||
// Only take action for the master player
|
|
||||||
if( pn != GAMESTATE->m_MasterPlayerNumber )
|
|
||||||
return;
|
|
||||||
|
|
||||||
switch( row )
|
switch( row )
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
@@ -113,8 +105,11 @@ void ScreenSMOnlineLogin::GoToPrevScreen()
|
|||||||
|
|
||||||
void ScreenSMOnlineLogin::GoToNextScreen()
|
void ScreenSMOnlineLogin::GoToNextScreen()
|
||||||
{
|
{
|
||||||
|
vector<PlayerNumber> v;
|
||||||
|
v.push_back( GAMESTATE->m_MasterPlayerNumber );
|
||||||
for( unsigned r=0; r<m_Rows.size(); r++ )
|
for( unsigned r=0; r<m_Rows.size(); r++ )
|
||||||
ExportOptions( r, GAMESTATE->m_MasterPlayerNumber );
|
ExportOptions( r, v );
|
||||||
|
|
||||||
PREFSMAN->SaveGlobalPrefsToDisk();
|
PREFSMAN->SaveGlobalPrefsToDisk();
|
||||||
FOREACH_EnabledPlayer(pn)
|
FOREACH_EnabledPlayer(pn)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -13,8 +13,8 @@ public:
|
|||||||
void SendLogin(CString sPassword);
|
void SendLogin(CString sPassword);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void ImportOptions( int row, PlayerNumber pn );
|
void ImportOptions( int row, const vector<PlayerNumber> &vpns );
|
||||||
void ExportOptions( int row, PlayerNumber pn );
|
void ExportOptions( int row, const vector<PlayerNumber> &vpns );
|
||||||
void GoToNextScreen();
|
void GoToNextScreen();
|
||||||
void GoToPrevScreen();
|
void GoToPrevScreen();
|
||||||
CString GetSelectedProfileID();
|
CString GetSelectedProfileID();
|
||||||
|
|||||||
Reference in New Issue
Block a user