onepad: use range loop for hash iteration

This commit is contained in:
Gregory Hainaut 2017-04-14 22:10:08 +02:00
parent c183de5662
commit a50766384b
2 changed files with 5 additions and 8 deletions

View File

@ -441,11 +441,9 @@ void Dialog::repopulate()
{
for (int gamepad_id = 0; gamepad_id < GAMEPAD_NUMBER; ++gamepad_id) {
// keyboard/mouse key
map<u32, u32>::iterator it;
for (it = conf->keysym_map[gamepad_id].begin();
it != conf->keysym_map[gamepad_id].end(); ++it) {
int keysym = it->first;
int key = it->second;
for (const auto &it : conf->keysym_map[gamepad_id]) {
int keysym = it.first;
int key = it.second;
m_bt_gamepad[gamepad_id][key]->SetLabel(
KeyName(gamepad_id, key, keysym).c_str());

View File

@ -95,10 +95,9 @@ void SaveConfig()
fprintf(f, "joy_pad_map = %d\n", conf->joyid_map);
fprintf(f, "ff_intensity = %d\n", conf->get_ff_intensity());
map<u32, u32>::iterator it;
for (int pad = 0; pad < GAMEPAD_NUMBER; pad++)
for (it = conf->keysym_map[pad].begin(); it != conf->keysym_map[pad].end(); ++it)
fprintf(f, "PAD %d:KEYSYM 0x%x = %d\n", pad, it->first, it->second);
for (auto const &it : conf->keysym_map[pad])
fprintf(f, "PAD %d:KEYSYM 0x%x = %d\n", pad, it.first, it.second);
fclose(f);
}