Annoying: allow OptionRowHandlers to specify what they reloaded, and
don't re-create things if we've only changed what's enabled. Use this with the Lua interface, by making EnabledForPlayers a function returning a table instead of a table.
This commit is contained in:
+23
-11
@@ -866,17 +866,31 @@ void OptionRow::Reload()
|
||||
// ExportOptions( vpns, bRowHasFocus );
|
||||
//}
|
||||
|
||||
if( !m_pHand->Reload() )
|
||||
return;
|
||||
switch( m_pHand->Reload() )
|
||||
{
|
||||
case OptionRowHandler::RELOAD_CHANGED_NONE:
|
||||
break;
|
||||
|
||||
ChoicesChanged();
|
||||
case OptionRowHandler::RELOAD_CHANGED_ALL:
|
||||
{
|
||||
ChoicesChanged();
|
||||
|
||||
vector<PlayerNumber> vpns;
|
||||
FOREACH_HumanPlayer( p )
|
||||
vpns.push_back( p );
|
||||
ImportOptions( vpns );
|
||||
FOREACH_HumanPlayer( p )
|
||||
AfterImportOptions( p );
|
||||
// fall through
|
||||
}
|
||||
|
||||
case OptionRowHandler::RELOAD_CHANGED_ENABLED:
|
||||
UpdateEnabledDisabled();
|
||||
FOREACH_HumanPlayer( pn )
|
||||
PositionUnderlines( pn );
|
||||
break;
|
||||
}
|
||||
|
||||
vector<PlayerNumber> vpns;
|
||||
FOREACH_HumanPlayer( p )
|
||||
vpns.push_back( p );
|
||||
ImportOptions( vpns );
|
||||
FOREACH_HumanPlayer( p )
|
||||
AfterImportOptions( p );
|
||||
|
||||
// TODO: Nothing uses this yet and it causes skips when changing options.
|
||||
//if( m_pHand->m_Def.m_bExportOnChange )
|
||||
@@ -885,8 +899,6 @@ void OptionRow::Reload()
|
||||
// ZERO( bRowHasFocus );
|
||||
// ExportOptions( vpns, bRowHasFocus );
|
||||
//}
|
||||
|
||||
UpdateEnabledDisabled();
|
||||
}
|
||||
|
||||
void OptionRow::HandleMessage( const RString& sMessage )
|
||||
|
||||
Reference in New Issue
Block a user