mirror of https://github.com/PCSX2/pcsx2.git
Use the iterator to get the value from maps to avoid two look ups.
This commit is contained in:
parent
0c1087a2e5
commit
ba7b0612dc
|
@ -567,8 +567,9 @@ void Pcsx2App::OnEmuKeyDown( wxKeyEvent& evt )
|
|||
const GlobalCommandDescriptor* cmd = NULL;
|
||||
if (GlobalAccels)
|
||||
{
|
||||
if (GlobalAccels->find(KeyAcceleratorCode(evt).val32) != GlobalAccels->end())
|
||||
cmd = GlobalAccels->at(KeyAcceleratorCode(evt).val32);
|
||||
std::unordered_map<int, const GlobalCommandDescriptor*>::const_iterator iter(GlobalAccels->find(KeyAcceleratorCode(evt).val32));
|
||||
if (iter != GlobalAccels->end())
|
||||
cmd = iter->second;
|
||||
}
|
||||
|
||||
if( cmd == NULL )
|
||||
|
|
|
@ -294,10 +294,11 @@ void GSPanel::DirectKeyCommand( const KeyAcceleratorCode& kac )
|
|||
{
|
||||
const GlobalCommandDescriptor* cmd = NULL;
|
||||
|
||||
if (m_Accels->find(kac.val32) == m_Accels->end())
|
||||
std::unordered_map<int, const GlobalCommandDescriptor*>::const_iterator iter(m_Accels->find(kac.val32));
|
||||
if (iter == m_Accels->end())
|
||||
return;
|
||||
|
||||
cmd = m_Accels->at(kac.val32);
|
||||
cmd = iter->second;
|
||||
|
||||
DbgCon.WriteLn( "(gsFrame) Invoking command: %s", cmd->Id );
|
||||
cmd->Invoke();
|
||||
|
|
|
@ -545,8 +545,9 @@ void AcceleratorDictionary::Map( const KeyAcceleratorCode& _acode, const char *s
|
|||
|
||||
const GlobalCommandDescriptor* result = NULL;
|
||||
|
||||
if (find(acode.val32) != end())
|
||||
result = at(acode.val32);
|
||||
std::unordered_map<int, const GlobalCommandDescriptor*>::const_iterator iter(find(acode.val32));
|
||||
if (iter != end())
|
||||
result = iter->second;
|
||||
|
||||
if( result != NULL )
|
||||
{
|
||||
|
@ -557,8 +558,10 @@ void AcceleratorDictionary::Map( const KeyAcceleratorCode& _acode, const char *s
|
|||
);
|
||||
}
|
||||
|
||||
if (wxGetApp().GlobalCommands->find(searchfor) != wxGetApp().GlobalCommands->end())
|
||||
result = wxGetApp().GlobalCommands->at(searchfor);
|
||||
std::unordered_map<std::string, const GlobalCommandDescriptor*>::const_iterator acceleratorIter(wxGetApp().GlobalCommands->find(searchfor));
|
||||
|
||||
if (acceleratorIter != wxGetApp().GlobalCommands->end())
|
||||
result = acceleratorIter->second;
|
||||
|
||||
if( result == NULL )
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue