diff options
| author | Lioncash <mathew1800@gmail.com> | 2014-01-30 19:51:21 -0500 |
|---|---|---|
| committer | Lioncash <mathew1800@gmail.com> | 2014-01-30 19:51:21 -0500 |
| commit | d91a5abba1d66948cc43cc7a6c80827ede061bc8 (patch) | |
| tree | 7693269f83a0343cac3b411575edaa05603ba40b /Source/Core/InputCommon/InputConfig.cpp | |
| parent | b5b02de663eb1fbad38ba3e3bcca85349963a65e (diff) | |
Light cleanup to a little bit of InputCommon. Replaces much of the iterators that litter this section of the codebase.
Also clean up a little bit of the comments that describe the interface classes.
Diffstat (limited to 'Source/Core/InputCommon/InputConfig.cpp')
| -rw-r--r-- | Source/Core/InputCommon/InputConfig.cpp | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/Source/Core/InputCommon/InputConfig.cpp b/Source/Core/InputCommon/InputConfig.cpp index d627d047ad..41f18c8403 100644 --- a/Source/Core/InputCommon/InputConfig.cpp +++ b/Source/Core/InputCommon/InputConfig.cpp @@ -10,10 +10,8 @@ InputPlugin::~InputPlugin() { // delete pads - std::vector<ControllerEmu*>::const_iterator i = controllers.begin(), - e = controllers.end(); - for ( ; i != e; ++i ) - delete *i; + for (ControllerEmu* pad : controllers) + delete pad; } bool InputPlugin::LoadConfig(bool isGC) @@ -58,25 +56,26 @@ bool InputPlugin::LoadConfig(bool isGC) if (inifile.Load(File::GetUserPath(D_CONFIG_IDX) + ini_name + ".ini")) { - std::vector< ControllerEmu* >::const_iterator - i = controllers.begin(), - e = controllers.end(); - for (int n = 0; i!=e; ++i, ++n) + int n = 0; + for (ControllerEmu* pad : controllers) { - // load settings from ini + // Load settings from ini if (useProfile[n]) { IniFile profile_ini; profile_ini.Load(File::GetUserPath(D_CONFIG_IDX) + path + profile[n] + ".ini"); - (*i)->LoadConfig(profile_ini.GetOrCreateSection("Profile")); + pad->LoadConfig(profile_ini.GetOrCreateSection("Profile")); } else { - (*i)->LoadConfig(inifile.GetOrCreateSection((*i)->GetName().c_str())); + pad->LoadConfig(inifile.GetOrCreateSection(pad->GetName().c_str())); } - // update refs - (*i)->UpdateReferences(g_controller_interface); + // Update refs + pad->UpdateReferences(g_controller_interface); + + // Next profile + n++; } return true; } @@ -95,10 +94,8 @@ void InputPlugin::SaveConfig() IniFile inifile; inifile.Load(ini_filename); - std::vector< ControllerEmu* >::const_iterator i = controllers.begin(), - e = controllers.end(); - for ( ; i!=e; ++i ) - (*i)->SaveConfig(inifile.GetOrCreateSection((*i)->GetName().c_str())); + for (ControllerEmu* pad : controllers) + pad->SaveConfig(inifile.GetOrCreateSection(pad->GetName().c_str())); inifile.Save(ini_filename); } |
