mirror of
				https://github.com/vcmi/vcmi.git
				synced 2025-10-31 00:07:39 +02:00 
			
		
		
		
	Merge pull request #4993 from IvanSavenko/mod_preset_fixes
Mod preset fixes
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 | ||||
|   | ||||
| @@ -266,9 +266,9 @@ void CModHandler::load() | ||||
| 		const auto & modInfo = getModInfo(modName); | ||||
| 		bool isValid = content->preloadData(modInfo, isModValidationNeeded(modInfo)); | ||||
| 		if (isValid) | ||||
| 			logGlobal->info("\t\tParsing mod: OK (%s)", modInfo.getName()); | ||||
| 			logGlobal->info("\t\tParsing mod: OK (%s)", modInfo.getID()); | ||||
| 		else | ||||
| 			logGlobal->warn("\t\tParsing mod: Issues found! (%s)", modInfo.getName()); | ||||
| 			logGlobal->warn("\t\tParsing mod: Issues found! (%s)", modInfo.getID()); | ||||
|  | ||||
| 		if (!isValid) | ||||
| 			validationPassed.erase(modName); | ||||
| @@ -280,9 +280,9 @@ void CModHandler::load() | ||||
| 		const auto & modInfo = getModInfo(modName); | ||||
| 		bool isValid = content->load(getModInfo(modName), isModValidationNeeded(getModInfo(modName))); | ||||
| 		if (isValid) | ||||
| 			logGlobal->info("\t\tLoading mod: OK (%s)", modInfo.getName()); | ||||
| 			logGlobal->info("\t\tLoading mod: OK (%s)", modInfo.getID()); | ||||
| 		else | ||||
| 			logGlobal->warn("\t\tLoading mod: Issues found! (%s)", modInfo.getName()); | ||||
| 			logGlobal->warn("\t\tLoading mod: Issues found! (%s)", modInfo.getID()); | ||||
|  | ||||
| 		if (!isValid) | ||||
| 			validationPassed.erase(modName); | ||||
|   | ||||
| @@ -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; | ||||
|   | ||||
| @@ -287,7 +287,7 @@ void ModsPresetState::eraseModSetting(const TModID & modName, const TModID & set | ||||
| { | ||||
| 	const std::string & currentPresetName = modConfig["activePreset"].String(); | ||||
| 	JsonNode & currentPreset = modConfig["presets"][currentPresetName]; | ||||
| 	currentPreset["settings"][modName].Struct().erase(modName); | ||||
| 	currentPreset["settings"][modName].Struct().erase(settingName); | ||||
| } | ||||
|  | ||||
| std::vector<TModID> ModsPresetState::getActiveMods() const | ||||
|   | ||||
		Reference in New Issue
	
	Block a user