mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-12 02:28:11 +02:00
skip campaigns from set
This commit is contained in:
parent
9c55ebf2dd
commit
6b33f4d969
@ -875,6 +875,8 @@ void SelectionTab::parseSaves(const std::unordered_set<ResourcePath> & files)
|
|||||||
|
|
||||||
void SelectionTab::parseCampaigns(const std::unordered_set<ResourcePath> & files)
|
void SelectionTab::parseCampaigns(const std::unordered_set<ResourcePath> & files)
|
||||||
{
|
{
|
||||||
|
auto campaignSets = JsonNode(JsonPath::builtin("config/campaignSets.json"));
|
||||||
|
|
||||||
allItems.reserve(files.size());
|
allItems.reserve(files.size());
|
||||||
for(auto & file : files)
|
for(auto & file : files)
|
||||||
{
|
{
|
||||||
@ -882,7 +884,15 @@ void SelectionTab::parseCampaigns(const std::unordered_set<ResourcePath> & files
|
|||||||
info->fileURI = file.getOriginalName();
|
info->fileURI = file.getOriginalName();
|
||||||
info->campaignInit();
|
info->campaignInit();
|
||||||
info->name = info->getNameForList();
|
info->name = info->getNameForList();
|
||||||
if(info->campaign)
|
|
||||||
|
// skip campaigns organized in sets
|
||||||
|
bool foundInSet = false;
|
||||||
|
for (auto const & set : campaignSets.Struct())
|
||||||
|
for (auto const & item : set.second["items"].Vector())
|
||||||
|
if(file.getName() == ResourcePath(item["file"].String()).getName())
|
||||||
|
foundInSet = true;
|
||||||
|
|
||||||
|
if(info->campaign && !foundInSet)
|
||||||
allItems.push_back(info);
|
allItems.push_back(info);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user