From f8943ee477e1cb5821e6208ee2d177c26c4b4ad3 Mon Sep 17 00:00:00 2001 From: Mikaƫl Capelle Date: Thu, 21 Jan 2021 19:38:53 +0100 Subject: Use range-loop instead of old-style iterators. --- src/modlist.cpp | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) (limited to 'src/modlist.cpp') 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 sourceIndices, int newPriority) }); // move mods that are decreasing in priority - for (std::vector::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 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::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 sourceIndices, int newPriority) } // move mods that are increasing in priority - for (std::vector::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); } } } -- cgit v1.3.1