mirror of
https://github.com/vcmi/vcmi.git
synced 2025-08-08 22:26:51 +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)
|
||||
{
|
||||
QStringList modNames;
|
||||
QStringList modsToEnable;
|
||||
|
||||
for(QString archive : archives)
|
||||
{
|
||||
@@ -900,7 +901,15 @@ void CModListView::installMods(QStringList archives)
|
||||
for(QString mod : modNames)
|
||||
{
|
||||
if(modStateModel->getMod(mod).isInstalled())
|
||||
{
|
||||
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++)
|
||||
@@ -909,7 +918,7 @@ void CModListView::installMods(QStringList archives)
|
||||
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
|
||||
}
|
||||
|
@@ -233,8 +233,7 @@ bool ModStateController::doInstallMod(QString modname, QString archivePath)
|
||||
if(upperLevel != modDirName)
|
||||
removeModDir(destDir + upperLevel);
|
||||
|
||||
CResourceHandler::get("initial")->updateFilteredFiles([](const std::string &) { return true; });
|
||||
//modList->reloadLocalMods();
|
||||
modList->reloadLocalState();
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -252,7 +251,6 @@ bool ModStateController::doUninstallMod(QString modname)
|
||||
if(!removeModDir(modDir))
|
||||
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();
|
||||
|
||||
return true;
|
||||
|
Reference in New Issue
Block a user