mirror of
				https://github.com/vcmi/vcmi.git
				synced 2025-10-31 00:07:39 +02:00 
			
		
		
		
	Do not inform of mod update if remote version is older than local
This commit is contained in:
		| @@ -217,7 +217,7 @@ bool ModState::isInstalled() const | ||||
|  | ||||
| bool ModState::isUpdateAvailable() const | ||||
| { | ||||
| 	return getInstalledVersion() != getRepositoryVersion() && !getRepositoryVersion().isEmpty() && !getInstalledVersion().isEmpty(); | ||||
| 	return impl.isUpdateAvailable(); | ||||
| } | ||||
|  | ||||
| bool ModState::isCompatible() const | ||||
|   | ||||
| @@ -216,4 +216,18 @@ bool ModDescription::affectsGameplay() const | ||||
| 	return false; | ||||
| } | ||||
|  | ||||
| bool ModDescription::isUpdateAvailable() const | ||||
| { | ||||
| 	if (getRepositoryValue("version").isNull()) | ||||
| 		return false; | ||||
|  | ||||
| 	if (getLocalValue("version").isNull()) | ||||
| 		return false; | ||||
|  | ||||
| 	auto localVersion = CModVersion::fromString(getLocalValue("version").String()); | ||||
| 	auto repositoryVersion = CModVersion::fromString(getRepositoryValue("version").String()); | ||||
|  | ||||
| 	return localVersion < repositoryVersion; | ||||
| } | ||||
|  | ||||
| VCMI_LIB_NAMESPACE_END | ||||
|   | ||||
| @@ -58,6 +58,7 @@ public: | ||||
| 	ModVerificationInfo getVerificationInfo() const; | ||||
|  | ||||
| 	bool isCompatible() const; | ||||
| 	bool isUpdateAvailable() const; | ||||
|  | ||||
| 	bool affectsGameplay() const; | ||||
| 	bool isCompatibility() const; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user