mirror of
https://github.com/vcmi/vcmi.git
synced 2025-04-13 11:40:38 +02:00
mods: Ignore submod conflicts for install, Ignore compatibility patches for enabling
This commit is contained in:
parent
70fad45316
commit
c6e4ef2a78
@ -94,13 +94,13 @@ bool CModEntry::isInstalled() const
|
|||||||
|
|
||||||
bool CModEntry::isVisible() const
|
bool CModEntry::isVisible() const
|
||||||
{
|
{
|
||||||
if (getBaseValue("modType").toString() == "Compatibility")
|
if (isCompatibilityPatch())
|
||||||
{
|
{
|
||||||
if (isSubmod())
|
if (isSubmod())
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getBaseValue("modType").toString() == "Translation")
|
if (isTranslation())
|
||||||
{
|
{
|
||||||
// Do not show not installed translation mods to languages other than player language
|
// Do not show not installed translation mods to languages other than player language
|
||||||
if (localData.empty() && getBaseValue("language") != QString::fromStdString(settings["general"]["language"].String()) )
|
if (localData.empty() && getBaseValue("language") != QString::fromStdString(settings["general"]["language"].String()) )
|
||||||
@ -115,6 +115,11 @@ bool CModEntry::isTranslation() const
|
|||||||
return getBaseValue("modType").toString() == "Translation";
|
return getBaseValue("modType").toString() == "Translation";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CModEntry::isCompatibilityPatch() const
|
||||||
|
{
|
||||||
|
return getBaseValue("modType").toString() == "Compatibility";
|
||||||
|
}
|
||||||
|
|
||||||
bool CModEntry::isSubmod() const
|
bool CModEntry::isSubmod() const
|
||||||
{
|
{
|
||||||
return getName().contains('.');
|
return getName().contains('.');
|
||||||
|
@ -54,8 +54,10 @@ public:
|
|||||||
bool isCompatible() const;
|
bool isCompatible() const;
|
||||||
// returns true if mod should be visible in Launcher
|
// returns true if mod should be visible in Launcher
|
||||||
bool isVisible() const;
|
bool isVisible() const;
|
||||||
// installed and enabled
|
// returns true if mod type is Translation
|
||||||
bool isTranslation() const;
|
bool isTranslation() const;
|
||||||
|
// returns true if mod type is Compatibility
|
||||||
|
bool isCompatibilityPatch() const;
|
||||||
// returns true if this is a submod
|
// returns true if this is a submod
|
||||||
bool isSubmod() const;
|
bool isSubmod() const;
|
||||||
|
|
||||||
|
@ -483,10 +483,10 @@ void CModListView::on_comboBox_currentIndexChanged(int index)
|
|||||||
QStringList CModListView::findInvalidDependencies(QString mod)
|
QStringList CModListView::findInvalidDependencies(QString mod)
|
||||||
{
|
{
|
||||||
QStringList ret;
|
QStringList ret;
|
||||||
for(QString requrement : modModel->getRequirements(mod))
|
for(QString requirement : modModel->getRequirements(mod))
|
||||||
{
|
{
|
||||||
if(!modModel->hasMod(requrement))
|
if(!modModel->hasMod(requirement) && !modModel->hasMod(requirement.split(QChar('.'), Qt::SkipEmptyParts)[0]))
|
||||||
ret += requrement;
|
ret += requirement;
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -614,6 +614,20 @@ void CModListView::on_installButton_clicked()
|
|||||||
auto mod = modModel->getMod(name);
|
auto mod = modModel->getMod(name);
|
||||||
if(!mod.isInstalled())
|
if(!mod.isInstalled())
|
||||||
downloadFile(name + ".zip", mod.getValue("download").toString(), "mods", mbToBytes(mod.getValue("downloadSize").toDouble()));
|
downloadFile(name + ".zip", mod.getValue("download").toString(), "mods", mbToBytes(mod.getValue("downloadSize").toDouble()));
|
||||||
|
else if(!mod.isEnabled())
|
||||||
|
enableModByName(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
for(auto & name : modModel->getMod(modName).getConflicts())
|
||||||
|
{
|
||||||
|
auto mod = modModel->getMod(name);
|
||||||
|
if(mod.isEnabled())
|
||||||
|
{
|
||||||
|
//TODO: consider reverse dependencies disabling
|
||||||
|
//TODO: consider if it may be possible for subdependencies to block disabling conflicting mod?
|
||||||
|
//TODO: consider if it may be possible to get subconflicts that will block disabling conflicting mod?
|
||||||
|
disableModByName(name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -195,7 +195,10 @@ bool CModManager::canEnableMod(QString modname)
|
|||||||
{
|
{
|
||||||
if(!modList->hasMod(modEntry)) // required mod is not available
|
if(!modList->hasMod(modEntry)) // required mod is not available
|
||||||
return addError(modname, QString("Required mod %1 is missing").arg(modEntry));
|
return addError(modname, QString("Required mod %1 is missing").arg(modEntry));
|
||||||
if(!modList->getMod(modEntry).isEnabled())
|
|
||||||
|
CModEntry modData = modList->getMod(modEntry);
|
||||||
|
|
||||||
|
if(!modData.isCompatibilityPatch() && !modData.isEnabled())
|
||||||
return addError(modname, QString("Required mod %1 is not enabled").arg(modEntry));
|
return addError(modname, QString("Required mod %1 is not enabled").arg(modEntry));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user