blob: ac4508d4f09c223d6d55a094df2bb5ad9886de39 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
#include "FomodDataContent.h"
#include <ifiletree.h>
#include "stringutil.h"
#include <iplugingame.h>
FomodDataContent::FomodDataContent(MOBase::IOrganizer* organizer) : mOrganizer(organizer)
{
}
std::vector<MOBase::ModDataContent::Content> FomodDataContent::getAllContents() const
{
static const std::vector<Content> contents = {
{FomodDataContentConstants::FOMOD_CONTENT_ID, "FOMOD", ":/fomod/hat", false}
};
return contents;
}
// Confirmed working, no need to update
std::vector<int> FomodDataContent::getContentsFor(const std::shared_ptr<const MOBase::IFileTree> fileTree) const
{
std::vector<int> contents;
if (!mOrganizer || !fileTree) {
return contents;
}
const auto modList = mOrganizer->modList();
if (!modList) {
return contents;
}
const auto mod = modList->getMod(fileTree->name());
if (modHasFomodContent(mod)) {
contents.emplace_back(FomodDataContentConstants::FOMOD_CONTENT_ID);
}
return contents;
}
bool FomodDataContent::modHasFomodContent(const MOBase::IModInterface* mod)
{
if (!mod) {
return false;
}
const auto pluginName = QString::fromStdString(StringConstants::Plugin::NAME.data());
const auto fomodMeta = mod->pluginSetting(pluginName, "fomod", 0);
return fomodMeta != 0;
}
|