mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Improve behaviour for empty modpacks and when no mods at all are installed:
Only show enable all / disable all buttons for all add-ons when at least one add-on is installed. When no add-on ist installed, don't show any buttons or checkboxes. Added is_modpack flag to ModSpec to distinguish empty modpacks from normal mods and check this flag in mod selection gui so that empty modpacks are not treated like mods that can be enabled or disabled.
This commit is contained in:
parent
e237c1d07d
commit
26a0efae23
3 changed files with 46 additions and 24 deletions
|
@ -46,6 +46,7 @@ std::map<std::string, ModSpec> getModsInPath(std::string path)
|
|||
modpack_is.close(); // We don't actually need the file
|
||||
ModSpec spec(modname,modpath);
|
||||
spec.modpack_content = getModsInPath(modpath);
|
||||
spec.is_modpack = true;
|
||||
result.insert(std::make_pair(modname,spec));
|
||||
}
|
||||
else // not a modpack, add the modspec
|
||||
|
@ -76,7 +77,7 @@ std::map<std::string, ModSpec> flattenModTree(std::map<std::string, ModSpec> mod
|
|||
it != mods.end(); ++it)
|
||||
{
|
||||
ModSpec mod = (*it).second;
|
||||
if(!mod.modpack_content.empty()) //is a modpack
|
||||
if(mod.is_modpack)
|
||||
{
|
||||
std::map<std::string, ModSpec> content =
|
||||
flattenModTree(mod.modpack_content);
|
||||
|
@ -98,7 +99,7 @@ std::vector<ModSpec> flattenMods(std::map<std::string, ModSpec> mods)
|
|||
it != mods.end(); ++it)
|
||||
{
|
||||
ModSpec mod = (*it).second;
|
||||
if(!mod.modpack_content.empty()) //is a modpack
|
||||
if(mod.is_modpack)
|
||||
{
|
||||
std::vector<ModSpec> content = flattenMods(mod.modpack_content);
|
||||
result.reserve(result.size() + content.size());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue