| 144 | } |
| 145 | |
| 146 | void LaunchProfile::applyMods(const QList<LibraryPtr>& mods) |
| 147 | { |
| 148 | QList<LibraryPtr> * list = &m_mods; |
| 149 | for(auto & mod: mods) |
| 150 | { |
| 151 | auto modCopy = Library::limitedCopy(mod); |
| 152 | |
| 153 | // find the mod by name. |
| 154 | const int index = findLibraryByName(list, mod->rawName()); |
| 155 | // mod not found? just add it. |
| 156 | if (index < 0) |
| 157 | { |
| 158 | list->append(modCopy); |
| 159 | return; |
| 160 | } |
| 161 | |
| 162 | auto existingLibrary = list->at(index); |
| 163 | // if we are higher it means we should update |
| 164 | if (Version(mod->version()) > Version(existingLibrary->version())) |
| 165 | { |
| 166 | list->replace(index, modCopy); |
| 167 | } |
| 168 | } |
| 169 | } |
| 170 | |
| 171 | void LaunchProfile::applyCompatibleJavaMajors(QList<int>& javaMajor) |
| 172 | { |