Skip to content

Commit eb94921

Browse files
committed
fixup mod filter
1 parent 7c8ad6c commit eb94921

3 files changed

Lines changed: 6 additions & 4 deletions

File tree

game/gothic.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ Gothic::Gothic() {
116116
}
117117

118118
std::vector<std::u16string> modvdfs;
119+
bool modFilter = true;
119120
if(modFile!=nullptr) {
120121
wrldDef = modFile->getS("SETTINGS","WORLD");
121122
size_t split = wrldDef.rfind('\\');
@@ -124,14 +125,15 @@ Gothic::Gothic() {
124125
plDef = modFile->getS("SETTINGS","PLAYER");
125126

126127
std::u16string vdf = TextCodec::toUtf16(std::string(modFile->getS("FILES","VDF")));
128+
modFilter = modFile->has("FILES","VDF");
127129
for(size_t start = 0, split = 0; split != std::string::npos; start = split+1) {
128130
split = vdf.find(' ', start);
129131
std::u16string mod = vdf.substr(start, split-start);
130132
if(!mod.empty())
131133
modvdfs.emplace_back(std::move(mod));
132134
}
133135
}
134-
Resources::loadVdfs(modvdfs);
136+
Resources::loadVdfs(modvdfs, modFilter);
135137

136138
if(wrldDef.empty()) {
137139
if(version().game==2)

game/resources.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,12 @@ Resources::Resources(Tempest::Device &device)
9292
}
9393
}
9494

95-
void Resources::loadVdfs(const std::vector<std::u16string>& modvdfs) {
95+
void Resources::loadVdfs(const std::vector<std::u16string>& modvdfs, bool modFilter) {
9696
std::vector<Archive> archives;
9797
inst->detectVdf(archives,Gothic::inst().nestedPath({u"Data"},Dir::FT_Dir));
9898

9999
// Remove all mod files, that are not listed in modvdfs
100-
if(!modvdfs.empty()) {
100+
if(modFilter) {
101101
// NOTE: apparently in CoM there is no mods list declaration. In such case - assume all modes
102102
archives.erase(std::remove_if(archives.begin(), archives.end(),
103103
[&modvdfs](const Archive& a){

game/resources.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ class Resources final {
8080

8181
static Tempest::Device& device() { return inst->dev; }
8282
static const char* renderer();
83-
static void loadVdfs(const std::vector<std::u16string> &modvdfs);
83+
static void loadVdfs(const std::vector<std::u16string> &modvdfs, bool modFilter);
8484

8585
static const Tempest::Sampler& shadowSampler();
8686

0 commit comments

Comments
 (0)