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;
|
const GlobalCommandDescriptor* cmd = NULL;
|
||||||
if (GlobalAccels)
|
if (GlobalAccels)
|
||||||
{
|
{
|
||||||
if (GlobalAccels->find(KeyAcceleratorCode(evt).val32) != GlobalAccels->end())
|
std::unordered_map<int, const GlobalCommandDescriptor*>::const_iterator iter(GlobalAccels->find(KeyAcceleratorCode(evt).val32));
|
||||||
cmd = GlobalAccels->at(KeyAcceleratorCode(evt).val32);
|
if (iter != GlobalAccels->end())
|
||||||
|
cmd = iter->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( cmd == NULL )
|
if( cmd == NULL )
|
||||||
|
|
|
@ -294,10 +294,11 @@ void GSPanel::DirectKeyCommand( const KeyAcceleratorCode& kac )
|
||||||
{
|
{
|
||||||
const GlobalCommandDescriptor* cmd = NULL;
|
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;
|
return;
|
||||||
|
|
||||||
cmd = m_Accels->at(kac.val32);
|
cmd = iter->second;
|
||||||
|
|
||||||
DbgCon.WriteLn( "(gsFrame) Invoking command: %s", cmd->Id );
|
DbgCon.WriteLn( "(gsFrame) Invoking command: %s", cmd->Id );
|
||||||
cmd->Invoke();
|
cmd->Invoke();
|
||||||
|
|
|
@ -545,8 +545,9 @@ void AcceleratorDictionary::Map( const KeyAcceleratorCode& _acode, const char *s
|
||||||
|
|
||||||
const GlobalCommandDescriptor* result = NULL;
|
const GlobalCommandDescriptor* result = NULL;
|
||||||
|
|
||||||
if (find(acode.val32) != end())
|
std::unordered_map<int, const GlobalCommandDescriptor*>::const_iterator iter(find(acode.val32));
|
||||||
result = at(acode.val32);
|
if (iter != end())
|
||||||
|
result = iter->second;
|
||||||
|
|
||||||
if( result != NULL )
|
if( result != NULL )
|
||||||
{
|
{
|
||||||
|
@ -557,8 +558,10 @@ void AcceleratorDictionary::Map( const KeyAcceleratorCode& _acode, const char *s
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wxGetApp().GlobalCommands->find(searchfor) != wxGetApp().GlobalCommands->end())
|
std::unordered_map<std::string, const GlobalCommandDescriptor*>::const_iterator acceleratorIter(wxGetApp().GlobalCommands->find(searchfor));
|
||||||
result = wxGetApp().GlobalCommands->at(searchfor);
|
|
||||||
|
if (acceleratorIter != wxGetApp().GlobalCommands->end())
|
||||||
|
result = acceleratorIter->second;
|
||||||
|
|
||||||
if( result == NULL )
|
if( result == NULL )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue