From 2c2c044191019457b2aead48ec7b265bcc5f878f Mon Sep 17 00:00:00 2001 From: nordsoft Date: Thu, 22 Sep 2022 17:15:49 +0400 Subject: [PATCH] revert launcher changes --- launcher/modManager/cmodlist.h | 4 ++++ launcher/modManager/cmodlistmodel_moc.cpp | 1 + launcher/modManager/cmodmanager.cpp | 4 ++++ 3 files changed, 9 insertions(+) diff --git a/launcher/modManager/cmodlist.h b/launcher/modManager/cmodlist.h index a5de09622..2bce79c6d 100644 --- a/launcher/modManager/cmodlist.h +++ b/launcher/modManager/cmodlist.h @@ -51,6 +51,10 @@ public: bool isInstalled() const; // vcmi essential files bool isEssential() const; + // checks if verison is compatible with vcmi + bool isCompatible() const; + // returns if has any data + bool isValid() const; // see ModStatus enum int getModStatus() const; diff --git a/launcher/modManager/cmodlistmodel_moc.cpp b/launcher/modManager/cmodlistmodel_moc.cpp index 2e94b8f81..fb2d3f1e0 100644 --- a/launcher/modManager/cmodlistmodel_moc.cpp +++ b/launcher/modManager/cmodlistmodel_moc.cpp @@ -245,6 +245,7 @@ bool CModFilterModel::filterMatchesThis(const QModelIndex & source) const { CModEntry mod = base->getMod(source.data(ModRoles::ModNameRole).toString()); return (mod.getModStatus() & filterMask) == filteredType && + mod.isValid() && QSortFilterProxyModel::filterAcceptsRow(source.row(), source.parent()); } diff --git a/launcher/modManager/cmodmanager.cpp b/launcher/modManager/cmodmanager.cpp index 3bc854bb3..eea55af17 100644 --- a/launcher/modManager/cmodmanager.cpp +++ b/launcher/modManager/cmodmanager.cpp @@ -169,6 +169,10 @@ bool CModManager::canEnableMod(QString modname) if(!mod.isInstalled()) return addError(modname, "Mod must be installed first"); + //check for compatibility + if(!mod.isCompatible()) + return addError(modname, "Mod is not compatible, please update VCMI and checkout latest mod revisions"); + for(auto modEntry : mod.getValue("depends").toStringList()) { if(!modList->hasMod(modEntry)) // required mod is not available