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:
Chris Danford
2005-04-03 06:21:02 +00:00
parent afd53cfc5e
commit 134cdb4451
17 changed files with 505 additions and 386 deletions
+68 -31
View File
@@ -720,9 +720,17 @@ void OptionRow::Reload()
if( m_pHand == NULL )
return;
if( m_RowDef.m_bExportOnChange )
FOREACH_HumanPlayer( p )
ExportOptions( p, false );
vector<PlayerNumber> vpns;
FOREACH_HumanPlayer( p )
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 );
ASSERT( !m_RowDef.choices.empty() );
@@ -730,8 +738,8 @@ void OptionRow::Reload()
FOREACH_PlayerNumber( p )
m_vbSelected[p].resize( m_RowDef.choices.size(), false );
FOREACH_HumanPlayer( p )
ImportOptions( p );
// TODO: Nothing uses this yet and it causes skips when changing options.
//ImportOptions( vpns );
switch( m_RowDef.selectType )
{
@@ -747,9 +755,13 @@ void OptionRow::Reload()
ASSERT(0);
}
if( m_RowDef.m_bExportOnChange )
FOREACH_HumanPlayer( p )
ExportOptions( p, false );
// 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 );
//}
UpdateEnabledDisabled();
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 )
return;
ASSERT( m_RowDef.choices.size() > 0 );
FOREACH( bool, m_vbSelected[pn], b )
*b = false;
FOREACH_CONST( PlayerNumber, vpns, iter )
{
PlayerNumber p = *iter;
ASSERT( m_vbSelected[pn].size() == m_RowDef.choices.size() );
ERASE_ONE_BOOL_AT_FRONT_IF_NEEDED( m_vbSelected[pn] );
m_pHand->ImportOption( m_RowDef, pn, m_vbSelected[pn] );
INSERT_ONE_BOOL_AT_FRONT_IF_NEEDED( m_vbSelected[pn] );
VerifySelected( m_RowDef.selectType, m_vbSelected[pn], m_RowDef.name );
FOREACH( bool, m_vbSelected[p], b )
*b = false;
ASSERT( m_vbSelected[p].size() == m_RowDef.choices.size() );
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 )
return 0;
@@ -818,23 +842,36 @@ int OptionRow::ExportOptions( PlayerNumber pn, bool bRowHasFocus )
int iChangeMask = 0;
VerifySelected( m_RowDef.selectType, m_vbSelected[pn], m_RowDef.name );
ASSERT( m_vbSelected[pn].size() == m_RowDef.choices.size() );
ERASE_ONE_BOOL_AT_FRONT_IF_NEEDED( m_vbSelected[pn] );
FOREACH_CONST( PlayerNumber, vpns, iter )
{
PlayerNumber p = *iter;
bool bFocus = bRowHasFocus[p];
// SELECT_NONE rows get exported if they have focus when the user presses
// Start.
int iChoice = GetChoiceInRowWithFocus( pn );
if( m_RowDef.selectType == SELECT_NONE && bRowHasFocus )
m_vbSelected[pn][iChoice] = true;
VerifySelected( m_RowDef.selectType, m_vbSelected[p], m_RowDef.name );
ASSERT( m_vbSelected[p].size() == m_RowDef.choices.size() );
ERASE_ONE_BOOL_AT_FRONT_IF_NEEDED( m_vbSelected[p] );
iChangeMask |= m_pHand->ExportOption( m_RowDef, pn, m_vbSelected[pn] );
if( m_RowDef.selectType == SELECT_NONE && bRowHasFocus )
m_vbSelected[pn][iChoice] = false;
INSERT_ONE_BOOL_AT_FRONT_IF_NEEDED( 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;
}
iChangeMask |= m_pHand->ExportOption( m_RowDef, vpns, m_vbSelected );
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;
}
+2 -2
View File
@@ -90,8 +90,8 @@ public:
CString GetRowTitle() const;
void ImportOptions( PlayerNumber pn );
int ExportOptions( PlayerNumber pn, bool bRowHasFocus );
void ImportOptions( const vector<PlayerNumber> &vpns );
int ExportOptions( const vector<PlayerNumber> &vpns, bool bRowHasFocus[NUM_PLAYERS] );
void AfterImportOptions( float fY );
void DetachHandler();
+376 -301
View File
@@ -151,75 +151,87 @@ public:
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;
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;
if( mc.IsZero() )
for( unsigned e = 0; e < ListEntries.size(); ++e )
{
/* 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 )
FallbackOption = e;
continue;
}
const GameCommand &mc = ListEntries[e];
if( def.bOneChoiceForAllPlayers )
{
if( mc.DescribesCurrentModeForAllPlayers() )
vbSelOut[e] = false;
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 )
SelectExactlyOne( e, vbSelectedOut );
else
vbSelectedOut[e] = true;
FallbackOption = e;
continue;
}
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) )
{
UseFallbackOption = false;
if( def.selectType != SELECT_MULTIPLE )
SelectExactlyOne( e, vbSelectedOut );
else
vbSelectedOut[e] = true;
}
LOG->Warn( "No options in row \"%s\" were selected, and no fallback row found; selected entry 0", m_sName.c_str() );
FallbackOption = 0;
}
}
if( UseFallbackOption && FallbackOption == -1 )
{
LOG->Warn( "No options in row \"%s\" were selected, and no fallback row found; selected entry 0", m_sName.c_str() );
FallbackOption = 0;
}
if( def.selectType == SELECT_ONE &&
UseFallbackOption &&
FallbackOption != -1 )
{
SelectExactlyOne( FallbackOption, vbSelectedOut );
if( def.selectType == SELECT_ONE &&
UseFallbackOption &&
FallbackOption != -1 )
{
SelectExactlyOne( FallbackOption, vbSelOut );
}
}
}
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 );
for( unsigned i=0; i<vbSelected.size(); i++ )
FOREACH_CONST( PlayerNumber, vpns, pn )
{
if( vbSelected[i] )
ListEntries[i].Apply( pn );
PlayerNumber p = *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;
}
@@ -500,55 +512,103 @@ public:
if( m_pLuaTable->GetLuaType() != LUA_TTABLE )
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" );
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 );
defOut.choices.push_back( pValue );
lua_pop( LUA->L, 1 ); /* removes `value'; keeps `key' for next iteration */
}
lua_pop( LUA->L, 1 ); /* pop choices table */
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 );
/* 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\" \"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 );
while( lua_next(LUA->L, -2) != 0 )
@@ -557,192 +617,165 @@ public:
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);
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 ); /* pop ReloadRowMessages table */
lua_pop( LUA->L, 1 ); /* pop choices table */
/* Look for "ExportOnChange" value. */
lua_pushstring( LUA->L, "ExportOnChange" );
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 */
/* Iterate over the "EnabledForPlayers" table. */
lua_pushstring( LUA->L, "EnabledForPlayers" );
lua_gettable( LUA->L, -2 );
if( !lua_isnil( LUA->L, -1 ) )
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 ) )
RageException::Throw( "\"%s\" \"EnabledForPlayers\" is not a table", sLuaFunction.c_str() );
/* `key' is at index -2 and `value' at index -1 */
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 );
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 ); /* removes `value'; keeps `key' for next iteration */
}
lua_pop( LUA->L, 1 ); /* pop EnabledForPlayers table */
}
lua_pop( LUA->L, 1 ); /* pop EnabledForPlayers table */
lua_pop( LUA->L, 1 ); /* pop main table */
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 );
if( !lua_isfunction( LUA->L, -1 ) )
RageException::Throw( "\"%s\" \"LoadSelections\" 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) p );
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->ReadArrayFromTableB( vbSelOut );
/* 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_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 */
/* Look for "ExportOnChange" value. */
lua_pushstring( LUA->L, "ExportOnChange" );
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 */
/* 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() );
m_vsReloadRowMessages.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 */
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 );
}
}
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 );
/* Evaluate the LoadSelections(self,array,pn) function, where array is a table
* representing vbSelectedOut. */
FOREACH_CONST( PlayerNumber, vpns, pn )
{
PlayerNumber p = *pn;
const vector<bool> &vbSel = vbSelected[p];
/* All selections default to false. */
for( unsigned i = 0; i < vbSelectedOut.size(); ++i )
vbSelectedOut[i] = false;
/* Evaluate SaveSelections(self,array,pn) function, where array is a table
* representing vbSelectedOut. */
/* Create the vbSelectedOut table. */
LUA->CreateTableFromArrayB( vbSelectedOut );
ASSERT( lua_gettop(LUA->L) == 1 ); /* vbSelectedOut table */
vector<bool> vbSelectedCopy = vbSel;
/* Get the function to call from m_LuaTable. */
m_pLuaTable->PushSelf( LUA->L );
ASSERT( lua_istable( LUA->L, -1 ) );
/* Create the vbSelectedOut table. */
LUA->CreateTableFromArrayB( vbSelectedCopy );
ASSERT( lua_gettop(LUA->L) == 1 ); /* vbSelectedOut table */
lua_pushstring( LUA->L, "LoadSelections" );
lua_gettable( LUA->L, -2 );
if( !lua_isfunction( LUA->L, -1 ) )
RageException::Throw( "\"%s\" \"LoadSelections\" entry is not a function", def.name.c_str() );
/* Get the function to call. */
m_pLuaTable->PushSelf( LUA->L );
ASSERT( lua_istable( LUA->L, -1 ) );
/* Argument 1 (self): */
m_pLuaTable->PushSelf( LUA->L );
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 2 (vbSelectedOut): */
lua_pushvalue( LUA->L, 1 );
/* Argument 1 (self): */
m_pLuaTable->PushSelf( LUA->L );
/* Argument 3 (pn): */
LuaHelpers::PushStack( (int) pn );
/* Argument 2 (vbSelectedOut): */
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) == 2 );
ASSERT( lua_gettop(LUA->L) == 6 ); /* vbSelectedOut, m_iLuaTable, function, self, arg, arg */
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 vbSelectedOut table */
lua_pop( LUA->L, 1 ); /* pop option table */
lua_pop( LUA->L, 1 ); /* pop vbSelected table */
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 );
ASSERT( lua_gettop(LUA->L) == 0 );
}
// XXX: allow specifying the mask
return 0;
@@ -781,29 +814,43 @@ public:
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();
SelectExactlyOne( iSelection, vbSelectedOut );
FOREACH_CONST( PlayerNumber, vpns, pn )
{
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. */
int Original = opt->Get();
FOREACH_CONST( PlayerNumber, vpns, pn )
{
PlayerNumber p = *pn;
const vector<bool> &vbSel = vbSelected[p];
/* Apply. */
opt->Put( sel );
int sel = GetOneSelection(vbSel);
/* Get the new choice. */
int New = opt->Get();
/* Get the original choice. */
int Original = opt->Get();
/* If it didn't change, don't return any side-effects. */
if( Original == New )
return 0;
/* Apply. */
opt->Put( sel );
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 )
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;
vector<StepsType>::const_iterator iter = find( m_vStepsTypesToShow.begin(), m_vStepsTypesToShow.end(), st );
if( iter != m_vStepsTypesToShow.end() )
PlayerNumber p = *pn;
vector<bool> &vbSelOut = vbSelectedOut[p];
if( GAMESTATE->m_pCurSteps[0] )
{
unsigned i = iter - m_vStepsTypesToShow.begin();
vbSelectedOut[i] = true;
return;
StepsType st = GAMESTATE->m_pCurSteps[0]->m_StepsType;
vector<StepsType>::const_iterator iter = find( m_vStepsTypesToShow.begin(), m_vStepsTypesToShow.end(), st );
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 );
m_pstToFill->Set( m_vStepsTypesToShow[index] );
FOREACH_CONST( PlayerNumber, vpns, pn )
{
PlayerNumber p = *pn;
const vector<bool> &vbSel = vbSelected[p];
int index = GetOneSelection( vbSel );
m_pstToFill->Set( m_vStepsTypesToShow[index] );
}
return 0;
}
};
@@ -992,43 +1052,58 @@ public:
m_pDifficultyToFill->Set( m_vDifficulties[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
vector<Steps*>::const_iterator iter = find( m_vSteps.begin(), m_vSteps.end(), m_ppStepsToFill->Get() );
if( iter != m_vSteps.end() )
{
unsigned i = iter - m_vSteps.begin();
vbSelectedOut[i] = true;
return;
}
// look for matching difficulty
if( m_pDifficultyToFill )
{
FOREACH_CONST( Difficulty, m_vDifficulties, d )
ASSERT( m_vSteps.size() == vbSelOut.size() );
// look for matching steps
vector<Steps*>::const_iterator iter = find( m_vSteps.begin(), m_vSteps.end(), m_ppStepsToFill->Get() );
if( iter != m_vSteps.end() )
{
unsigned i = d - m_vDifficulties.begin();
if( *d == GAMESTATE->m_PreferredDifficulty[0] )
unsigned i = iter - m_vSteps.begin();
vbSelOut[i] = true;
return;
}
// look for matching difficulty
if( m_pDifficultyToFill )
{
FOREACH_CONST( Difficulty, m_vDifficulties, d )
{
vbSelectedOut[i] = true;
ExportOption( def, pn, vbSelectedOut ); // current steps changed
return;
unsigned i = d - m_vDifficulties.begin();
if( *d == GAMESTATE->m_PreferredDifficulty[0] )
{
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 );
Difficulty dc = m_vDifficulties[index];
Steps *pSteps = m_vSteps[index];
if( m_pDifficultyToFill )
m_pDifficultyToFill->Set( dc );
m_ppStepsToFill->Set( pSteps );
FOREACH_CONST( PlayerNumber, vpns, pn )
{
PlayerNumber p = *pn;
const vector<bool> &vbSel = vbSelected[p];
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;
}
};
+3 -3
View File
@@ -23,10 +23,10 @@ public:
m_vsReloadRowMessages.clear();
}
virtual void Load( OptionRowDefinition &defOut, CString sParam ) = 0;
void Reload( OptionRowDefinition &defOut ) { this->Load(defOut,m_sName); }
virtual void ImportOption( const OptionRowDefinition &row, PlayerNumber pn, vector<bool> &vbSelectedOut ) const = 0;
virtual void Reload( OptionRowDefinition &defOut ) { this->Load(defOut,m_sName); }
virtual void ImportOption( const OptionRowDefinition &row, const vector<PlayerNumber> &vpns, vector<bool> vbSelectedOut[NUM_PLAYERS] ) const = 0;
/* 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 bool HasScreen( int iChoice ) const { return false; }
};
+2 -2
View File
@@ -86,7 +86,7 @@ void ScreenMiniMenu::Init( const Menu* pDef, ScreenMessage SM_SendOnOK, ScreenMe
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];
MenuRow &mr = m_vMenuRows[r];
@@ -94,7 +94,7 @@ void ScreenMiniMenu::ImportOptions( int r, PlayerNumber pn )
optrow.SetOneSharedSelection( mr.iDefaultChoice );
}
void ScreenMiniMenu::ExportOptions( int r, PlayerNumber pn )
void ScreenMiniMenu::ExportOptions( int r, const vector<PlayerNumber> &vpns )
{
if( r == GetCurrentRow() )
s_iLastRowCode = m_vMenuRows[r].iRowCode;
+2 -2
View File
@@ -58,8 +58,8 @@ public:
ScreenMiniMenu( CString sScreenClass );
void Init( const Menu* pDef, ScreenMessage SM_SendOnOK, ScreenMessage SM_SendOnCancel );
protected:
virtual void ImportOptions( int row, PlayerNumber pn );
virtual void ExportOptions( int row, PlayerNumber pn );
virtual void ImportOptions( int row, const vector<PlayerNumber> &vpns );
virtual void ExportOptions( int row, const vector<PlayerNumber> &vpns );
virtual void GoToNextScreen();
virtual void GoToPrevScreen();
+2 -2
View File
@@ -154,8 +154,8 @@ void ScreenNetworkOptions::MenuStart( PlayerNumber pn, const InputEventType type
#endif
}
void ScreenNetworkOptions::ImportOptions( int row, PlayerNumber pn ) { }
void ScreenNetworkOptions::ExportOptions( int row, PlayerNumber pn ) { }
void ScreenNetworkOptions::ImportOptions( int row, const vector<PlayerNumber> &vpns ) { }
void ScreenNetworkOptions::ExportOptions( int row, const vector<PlayerNumber> &vpns ) { }
void ScreenNetworkOptions::UpdateConnectStatus( )
{
+2 -2
View File
@@ -14,8 +14,8 @@ public:
virtual void MenuStart( PlayerNumber pn, const InputEventType type );
private:
void ImportOptions( int row, PlayerNumber pn );
void ExportOptions( int row, PlayerNumber pn );
void ImportOptions( int row, const vector<PlayerNumber> &vpns );
void ExportOptions( int row, const vector<PlayerNumber> &vpns );
void GoToNextScreen();
void GoToPrevScreen();
+13 -3
View File
@@ -154,8 +154,10 @@ void ScreenOptions::InitMenu( InputMode im, const vector<OptionRowDefinition> &v
row.LoadMetrics( m_sName );
row.LoadNormal( def, hand, bFirstRowGoesDown );
vector<PlayerNumber> vpns;
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()) );
@@ -511,8 +513,12 @@ void ScreenOptions::HandleScreenMessage( const ScreenMessage SM )
break;
case SM_GoToNextScreen:
for( unsigned r=0; r<m_Rows.size(); r++ ) // foreach row
{
vector<PlayerNumber> vpns;
FOREACH_HumanPlayer( p )
this->ExportOptions( r, p );
vpns.push_back( p );
this->ExportOptions( r, vpns );
}
this->GoToNextScreen();
break;
case SM_BeginFadingOut:
@@ -999,8 +1005,12 @@ void ScreenOptions::ChangeValueInRow( PlayerNumber pn, int iDelta, bool Repeat )
m_SoundChangeCol.Play();
if( row.GetRowDef().m_bExportOnChange )
{
vector<PlayerNumber> vpns;
FOREACH_HumanPlayer( p )
ExportOptions( iCurRow, p );
vpns.push_back( p );
ExportOptions( iCurRow, vpns );
}
}
+2 -2
View File
@@ -34,8 +34,8 @@ public:
virtual void HandleScreenMessage( const ScreenMessage SM );
protected:
virtual void ImportOptions( int row, PlayerNumber pn ) = 0;
virtual void ExportOptions( int row, PlayerNumber pn ) = 0;
virtual void ImportOptions( int row, const vector<PlayerNumber> &vpns ) = 0;
virtual void ExportOptions( int row, const vector<PlayerNumber> &vpns ) = 0;
void InitOptionsText();
void GetWidthXY( PlayerNumber pn, int iRow, int iChoiceOnRow, int &iWidthOut, int &iXOut, int &iYOut );
+13 -7
View File
@@ -105,18 +105,22 @@ ScreenOptionsMaster::~ScreenOptionsMaster()
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];
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];
bool bRowHasFocus = m_iCurrentRow[pn] == r;
m_iChangeMask |= row.ExportOptions( pn, bRowHasFocus );
bool bRowHasFocus[NUM_PLAYERS];
ZERO( bRowHasFocus );
FOREACH_CONST( PlayerNumber, vpns, pn )
bRowHasFocus[*pn] = m_iCurrentRow[*pn] == r;
m_iChangeMask |= row.ExportOptions( vpns, bRowHasFocus );
}
void ScreenOptionsMaster::BeginFadingOut()
@@ -216,8 +220,10 @@ void ScreenOptionsMaster::HandleScreenMessage( const ScreenMessage SM )
{
CHECKPOINT_M( ssprintf("%i/%i", r, int(OptionRowHandlers.size())) );
vector<PlayerNumber> vpns;
FOREACH_OptionsPlayer( p )
ExportOptions( r, p );
vpns.push_back( p );
ExportOptions( r, vpns );
}
if( m_iChangeMask & OPT_APPLY_ASPECT_RATIO )
+2 -2
View File
@@ -21,8 +21,8 @@ protected:
protected:
void HandleScreenMessage( const ScreenMessage SM );
virtual void ImportOptions( int row, PlayerNumber pn );
virtual void ExportOptions( int row, PlayerNumber pn );
virtual void ImportOptions( int row, const vector<PlayerNumber> &vpns );
virtual void ExportOptions( int row, const vector<PlayerNumber> &vpns );
virtual void BeginFadingOut();
virtual void GoToNextScreen();
+6 -2
View File
@@ -150,7 +150,9 @@ void ScreenPlayerOptions::Input( const DeviceInput& DeviceI, const InputEventTyp
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->UpdateDisqualified( r, pn );
}
@@ -205,7 +207,9 @@ void ScreenPlayerOptions::UpdateDisqualified( int row, PlayerNumber pn )
// Find out if the current row when exprorted causes disqualification.
// Exporting the row will fill GAMESTATE->m_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 );
m_bRowCausesDisqualified[pn][row] = bRowCausesDisqualified;
+2 -10
View File
@@ -84,12 +84,8 @@ void ScreenProfileOptions::Init()
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 )
{
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 )
{
case PO_PLAYER1:
+2 -2
View File
@@ -14,8 +14,8 @@ public:
virtual void MenuStart( PlayerNumber pn, const InputEventType type );
private:
void ImportOptions( int row, PlayerNumber pn );
void ExportOptions( int row, PlayerNumber pn );
void ImportOptions( int row, const vector<PlayerNumber> &vpns );
void ExportOptions( int row, const vector<PlayerNumber> &vpns );
void GoToNextScreen();
void GoToPrevScreen();
+6 -11
View File
@@ -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 )
{
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 )
{
case 0:
@@ -113,8 +105,11 @@ void ScreenSMOnlineLogin::GoToPrevScreen()
void ScreenSMOnlineLogin::GoToNextScreen()
{
vector<PlayerNumber> v;
v.push_back( GAMESTATE->m_MasterPlayerNumber );
for( unsigned r=0; r<m_Rows.size(); r++ )
ExportOptions( r, GAMESTATE->m_MasterPlayerNumber );
ExportOptions( r, v );
PREFSMAN->SaveGlobalPrefsToDisk();
FOREACH_EnabledPlayer(pn)
{
+2 -2
View File
@@ -13,8 +13,8 @@ public:
void SendLogin(CString sPassword);
private:
void ImportOptions( int row, PlayerNumber pn );
void ExportOptions( int row, PlayerNumber pn );
void ImportOptions( int row, const vector<PlayerNumber> &vpns );
void ExportOptions( int row, const vector<PlayerNumber> &vpns );
void GoToNextScreen();
void GoToPrevScreen();
CString GetSelectedProfileID();