diff options
| author | isanae <14251494+isanae@users.noreply.github.com> | 2020-05-28 23:42:53 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-05-28 23:42:53 -0400 |
| commit | da35955d6c15c4abc83ae8c0a4ea8195c0c0ac85 (patch) | |
| tree | beab5513b64e93c32d50f628321654623b603129 /src/modinforegular.cpp | |
| parent | 652d3ab054cd2bd94fe88dc42aa39798fc3b2c4a (diff) | |
| parent | 0a5790b333883c7c4ef07bb44f0a411ce8ba79b5 (diff) | |
Merge pull request #1092 from Holt59/mod-data-content
Use ModDataContent feature from GamePlugin
Diffstat (limited to 'src/modinforegular.cpp')
| -rw-r--r-- | src/modinforegular.cpp | 58 |
1 files changed, 7 insertions, 51 deletions
diff --git a/src/modinforegular.cpp b/src/modinforegular.cpp index a1f1a04d..8ef8e007 100644 --- a/src/modinforegular.cpp +++ b/src/modinforegular.cpp @@ -3,7 +3,7 @@ #include "categories.h" #include "messagedialog.h" #include "report.h" -#include "scriptextender.h" +#include "moddatacontent.h" #include "settings.h" #include <QApplication> @@ -653,60 +653,16 @@ std::vector<ModInfo::EFlag> ModInfoRegular::getFlags() const } -std::vector<ModInfo::EContent> ModInfoRegular::doGetContents() const +std::set<int> ModInfoRegular::doGetContents() const { - auto tree = contentFileTree(); - std::vector<ModInfo::EContent> contents; + ModDataContent* contentFeature = m_GamePlugin->feature<ModDataContent>(); - for (auto e : *tree) { - if (e->isFile()) { - auto suffix = e->suffix().toLower(); - if (suffix == "esp" || suffix == "esm" || suffix == "esl") { - contents.push_back(CONTENT_PLUGIN); - } - else if (suffix == "bsa" || suffix == "ba2") { - contents.push_back(CONTENT_BSA); - } - else if (suffix == "ini" && e->compare("meta.ini") != 0) { - contents.push_back(CONTENT_INI); - } - else if (suffix == "modgroups") { - contents.push_back(CONTENT_MODGROUP); - } - } - else { - if (e->compare("textures") == 0 || e->compare("icons") == 0 || e->compare("bookart") == 0) - contents.push_back(CONTENT_TEXTURE); - if (e->compare("meshes") == 0) - contents.push_back(CONTENT_MESH); - if (e->compare("interface") == 0 || e->compare("menus") == 0) - contents.push_back(CONTENT_INTERFACE); - if (e->compare("music") == 0 || e->compare("sound") == 0) - contents.push_back(CONTENT_SOUND); - if (e->compare("scripts") == 0) - contents.push_back(CONTENT_SCRIPT); - if (e->compare("SkyProc Patchers") == 0) - contents.push_back(CONTENT_SKYPROC); - if (e->compare("MCM") == 0) - contents.push_back(CONTENT_MCM); - } - } - - ScriptExtender* extender = m_GamePlugin->feature<ScriptExtender>(); - if (extender != nullptr) { - auto e = tree->findDirectory(extender->PluginPath()); - if (e) { - contents.push_back(CONTENT_SKSEFILES); - for (auto f : *e) { - if (f->hasSuffix("dll")) { - contents.push_back(CONTENT_SKSE); - break; - } - } - } + if (contentFeature) { + auto result = contentFeature->getContentsFor(contentFileTree()); + return std::set<int>(std::begin(result), std::end(result)); } - return contents; + return {}; } |
