diff --git a/src/red4ext/ModSettings.cpp b/src/red4ext/ModSettings.cpp index 6f377a9..63e2bb9 100644 --- a/src/red4ext/ModSettings.cpp +++ b/src/red4ext/ModSettings.cpp @@ -225,20 +225,20 @@ DynArray ModSettings::GetMods() { DynArray ModSettings::GetCategories(CName modName) { auto array = DynArray(new Memory::DefaultAllocator); + std::vector> modCategories; for (auto const &[modClassName, modClass] : modSettings.mods[modName].classes) { - std::vector> modCategories; for (auto itr = modClass.categories.begin(); itr != modClass.categories.end(); ++itr ) { modCategories.push_back(*itr); } - sort(modCategories.begin(), modCategories.end(), [=](std::pair& a, std::pair& b) { - return a.second.order < b.second.order; - }); - for (auto const &[categoryName, category] : modCategories) { - if (categoryName != "None" && !category.variables.empty()) { - auto position = std::find(array.begin(), array.end(), categoryName); - if (position == array.end()) - array.EmplaceBack(categoryName); - } + } + sort(modCategories.begin(), modCategories.end(), [=](std::pair& a, std::pair& b) { + return a.second.order < b.second.order; + }); + for (auto const &[categoryName, category] : modCategories) { + if (categoryName != "None" && !category.variables.empty()) { + auto position = std::find(array.begin(), array.end(), categoryName); + if (position == array.end()) + array.EmplaceBack(categoryName); } } return array;