add FOREACH_GameButtonInScheme
This commit is contained in:
@@ -26,10 +26,10 @@ RString GameButtonToLocalizedString( const InputScheme* pInputs, GameButton i )
|
||||
|
||||
GameButton StringToGameButton( const InputScheme* pInputs, const RString& s )
|
||||
{
|
||||
for( int i=0; i<pInputs->m_iButtonsPerController; i++ )
|
||||
FOREACH_GameButtonInScheme( pInputs, i )
|
||||
{
|
||||
if( s == GameButtonToString(pInputs,(GameButton)i) )
|
||||
return (GameButton)i;
|
||||
if( s == GameButtonToString(pInputs, i) )
|
||||
return i;
|
||||
}
|
||||
return GameButton_Invalid;
|
||||
}
|
||||
|
||||
@@ -55,13 +55,13 @@ void InputMapper::AddDefaultMappingsForCurrentGameIfUnmapped()
|
||||
|
||||
FOREACH_GameController( c )
|
||||
{
|
||||
for( int b=0; b<m_pInputScheme->m_iButtonsPerController; b++ )
|
||||
FOREACH_GameButtonInScheme( m_pInputScheme, b )
|
||||
{
|
||||
DeviceButton key = m_pInputScheme->m_GameButtonInfo[b].m_iDefaultKeyboardKey[c];
|
||||
if( key == NO_DEFAULT_KEY )
|
||||
continue;
|
||||
DeviceInput DeviceI( DEVICE_KEYBOARD, key );
|
||||
GameInput GameI( c, (GameButton)b );
|
||||
GameInput GameI( c, b );
|
||||
if( !IsMapped(DeviceI) ) // if this key isn't already being used by another user-made mapping
|
||||
SetInputMap( DeviceI, GameI, 2 );
|
||||
}
|
||||
@@ -600,9 +600,9 @@ void InputMapper::SaveMappingsToDisk()
|
||||
// iterate over our input map and write all mappings to the ini file
|
||||
FOREACH_GameController( i )
|
||||
{
|
||||
for( int j=0; j<m_pInputScheme->m_iButtonsPerController; j++ )
|
||||
FOREACH_GameButtonInScheme( m_pInputScheme, j )
|
||||
{
|
||||
GameInput GameI( i, (GameButton)j );
|
||||
GameInput GameI( i, j );
|
||||
RString sNameString = GameI.ToString( m_pInputScheme );
|
||||
|
||||
vector<RString> asValues;
|
||||
|
||||
@@ -32,6 +32,7 @@ public:
|
||||
MenuButton GameInputToMenuButton( GameInput GameI ) const;
|
||||
void MenuButtonToGameInputs( MenuButton MenuI, PlayerNumber pn, GameInput GameIout[4] ) const;
|
||||
};
|
||||
#define FOREACH_GameButtonInScheme( s, var ) for( GameButton var=(GameButton)0; var<s->m_iButtonsPerController; enum_add<GameButton>( var, +1 ) )
|
||||
|
||||
class InputMapper
|
||||
{
|
||||
|
||||
@@ -46,10 +46,10 @@ void ScreenMapControllers::Init()
|
||||
if( sButtons.empty() )
|
||||
{
|
||||
/* Map all buttons for this game. */
|
||||
for( int b=0; b<INPUTMAPPER->GetInputScheme()->m_iButtonsPerController; b++ )
|
||||
FOREACH_GameButtonInScheme( INPUTMAPPER->GetInputScheme(), gb )
|
||||
{
|
||||
KeyToMap k;
|
||||
k.m_GameButton = (GameButton) b;
|
||||
k.m_GameButton = gb;
|
||||
m_KeysToMap.push_back( k );
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user