diff options
| author | Mikaël Capelle <capelle.mikael@gmail.com> | 2021-01-21 19:38:53 +0100 |
|---|---|---|
| committer | Mikaël Capelle <capelle.mikael@gmail.com> | 2021-01-21 19:38:53 +0100 |
| commit | f8943ee477e1cb5821e6208ee2d177c26c4b4ad3 (patch) | |
| tree | 5252994bb25713fa399508febd5378fa0a8b1827 /src | |
| parent | 62a9d13948e6e299d41eb6876c0f1fbaf0160d79 (diff) | |
Use range-loop instead of old-style iterators.
Diffstat (limited to 'src')
| -rw-r--r-- | src/modlist.cpp | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/src/modlist.cpp b/src/modlist.cpp index f83acc9c..5cbc6c9f 100644 --- a/src/modlist.cpp +++ b/src/modlist.cpp @@ -714,12 +714,11 @@ void ModList::changeModPriority(std::vector<int> sourceIndices, int newPriority) }); // move mods that are decreasing in priority - for (std::vector<int>::const_iterator iter = sourceIndices.begin(); - iter != sourceIndices.end(); ++iter) { - int oldPriority = m_Profile->getModPriority(*iter); + for (const auto& index : sourceIndices) { + int oldPriority = m_Profile->getModPriority(index); if (oldPriority > newPriority) { - if (m_Profile->setModPriority(*iter, newPriority)) { - m_ModMoved(ModInfo::getByIndex(*iter)->name(), oldPriority, newPriority); + if (m_Profile->setModPriority(index, newPriority)) { + m_ModMoved(ModInfo::getByIndex(index)->name(), oldPriority, newPriority); } } } @@ -732,9 +731,8 @@ void ModList::changeModPriority(std::vector<int> sourceIndices, int newPriority) // if at least one mod is increasing in priority, the target index is // that of the row BELOW the dropped location, otherwise it's the one above - for (std::vector<int>::const_iterator iter = sourceIndices.begin(); - iter != sourceIndices.end(); ++iter) { - int oldPriority = m_Profile->getModPriority(*iter); + for (const auto& index : sourceIndices) { + int oldPriority = m_Profile->getModPriority(index); if (oldPriority < newPriority) { --newPriority; break; @@ -742,12 +740,11 @@ void ModList::changeModPriority(std::vector<int> sourceIndices, int newPriority) } // move mods that are increasing in priority - for (std::vector<int>::const_iterator iter = sourceIndices.begin(); - iter != sourceIndices.end(); ++iter) { - int oldPriority = m_Profile->getModPriority(*iter); + for (const auto& index : sourceIndices) { + int oldPriority = m_Profile->getModPriority(index); if (oldPriority < newPriority) { - if (m_Profile->setModPriority(*iter, newPriority)) { - m_ModMoved(ModInfo::getByIndex(*iter)->name(), oldPriority, newPriority); + if (m_Profile->setModPriority(index, newPriority)) { + m_ModMoved(ModInfo::getByIndex(index)->name(), oldPriority, newPriority); } } } |
