mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-27 22:49:25 +02:00
Don't auto-enable mods on update
This commit is contained in:
@@ -886,6 +886,7 @@ void CModListView::installFiles(QStringList files)
|
|||||||
void CModListView::installMods(QStringList archives)
|
void CModListView::installMods(QStringList archives)
|
||||||
{
|
{
|
||||||
QStringList modNames;
|
QStringList modNames;
|
||||||
|
QStringList modsToEnable;
|
||||||
|
|
||||||
for(QString archive : archives)
|
for(QString archive : archives)
|
||||||
{
|
{
|
||||||
@@ -900,7 +901,15 @@ void CModListView::installMods(QStringList archives)
|
|||||||
for(QString mod : modNames)
|
for(QString mod : modNames)
|
||||||
{
|
{
|
||||||
if(modStateModel->getMod(mod).isInstalled())
|
if(modStateModel->getMod(mod).isInstalled())
|
||||||
|
{
|
||||||
manager->uninstallMod(mod);
|
manager->uninstallMod(mod);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// installation of previously not present mod -> enable it
|
||||||
|
if (modStateModel->isModEnabled(mod))
|
||||||
|
modsToEnable.push_back(mod);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int i = 0; i < modNames.size(); i++)
|
for(int i = 0; i < modNames.size(); i++)
|
||||||
@@ -909,7 +918,7 @@ void CModListView::installMods(QStringList archives)
|
|||||||
manager->installMod(modNames[i], archives[i]);
|
manager->installMod(modNames[i], archives[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
for(QString mod : modNames)
|
for(QString mod : modsToEnable)
|
||||||
{
|
{
|
||||||
manager->enableMod(mod); // TODO: make it as a single action, so if mod 1 depends on mod 2 it would still activate
|
manager->enableMod(mod); // TODO: make it as a single action, so if mod 1 depends on mod 2 it would still activate
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -233,8 +233,7 @@ bool ModStateController::doInstallMod(QString modname, QString archivePath)
|
|||||||
if(upperLevel != modDirName)
|
if(upperLevel != modDirName)
|
||||||
removeModDir(destDir + upperLevel);
|
removeModDir(destDir + upperLevel);
|
||||||
|
|
||||||
CResourceHandler::get("initial")->updateFilteredFiles([](const std::string &) { return true; });
|
modList->reloadLocalState();
|
||||||
//modList->reloadLocalMods();
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -252,7 +251,6 @@ bool ModStateController::doUninstallMod(QString modname)
|
|||||||
if(!removeModDir(modDir))
|
if(!removeModDir(modDir))
|
||||||
return addError(modname, tr("Mod is located in protected directory, please remove it manually:\n") + modFullDir.absolutePath());
|
return addError(modname, tr("Mod is located in protected directory, please remove it manually:\n") + modFullDir.absolutePath());
|
||||||
|
|
||||||
CResourceHandler::get("initial")->updateFilteredFiles([](const std::string &){ return true; });
|
|
||||||
modList->reloadLocalState();
|
modList->reloadLocalState();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Reference in New Issue
Block a user