1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00
This commit is contained in:
Laserlicht 2024-11-12 00:12:56 +01:00
parent e660d30b8a
commit 719859cc62

View File

@ -885,24 +885,28 @@ void SelectionTab::parseCampaigns(const std::unordered_set<ResourcePath> & files
info->fileURI = file.getOriginalName();
info->campaignInit();
info->name = info->getNameForList();
// skip campaigns organized in sets
std::string foundInSet = "";
for (auto const & set : campaignSets.Struct())
for (auto const & item : set.second["items"].Vector())
if(file.getName() == ResourcePath(item["file"].String()).getName())
foundInSet = set.first;
// set has to be used in main menu
bool setInMainmenu = false;
if(!foundInSet.empty())
for (auto const & item : mainmenu["window"]["items"].Vector())
for (auto const & button : item["buttons"].Vector())
if(boost::algorithm::contains(boost::algorithm::to_lower_copy(button["command"].String()), boost::algorithm::to_lower_copy(foundInSet)))
setInMainmenu = true;
if(info->campaign && !setInMainmenu)
allItems.push_back(info);
if(info->campaign)
{
// skip campaigns organized in sets
std::string foundInSet = "";
for (auto const & set : campaignSets.Struct())
for (auto const & item : set.second["items"].Vector())
if(file.getName() == ResourcePath(item["file"].String()).getName())
foundInSet = set.first;
// set has to be used in main menu
bool setInMainmenu = false;
if(!foundInSet.empty())
for (auto const & item : mainmenu["window"]["items"].Vector())
if(item["name"].String() == "campaign")
for (auto const & button : item["buttons"].Vector())
if(boost::algorithm::contains(boost::algorithm::to_lower_copy(button["command"].String()), boost::algorithm::to_lower_copy(foundInSet)))
setInMainmenu = true;
if(!setInMainmenu)
allItems.push_back(info);
}
}
}