2023-07-30 19:12:25 +02:00
|
|
|
/*
|
|
|
|
* CModInfo.h, part of VCMI engine
|
|
|
|
*
|
|
|
|
* Authors: listed in file AUTHORS in main folder
|
|
|
|
*
|
|
|
|
* License: GNU General Public License v2.0 or later
|
|
|
|
* Full text of license available in license.txt file, in main folder
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
2024-02-11 23:09:01 +02:00
|
|
|
#include "../json/JsonNode.h"
|
2023-11-07 18:32:40 +02:00
|
|
|
#include "ModVerificationInfo.h"
|
2023-07-30 19:12:25 +02:00
|
|
|
|
|
|
|
VCMI_LIB_NAMESPACE_BEGIN
|
|
|
|
|
|
|
|
class DLL_LINKAGE CModInfo
|
|
|
|
{
|
2023-08-18 14:08:23 +02:00
|
|
|
/// cached result of checkModGameplayAffecting() call
|
|
|
|
/// Do not serialize - depends on local mod version, not server/save mod version
|
|
|
|
mutable std::optional<bool> modGameplayAffecting;
|
|
|
|
|
2023-11-19 20:44:28 +02:00
|
|
|
static std::set<TModID> readModList(const JsonNode & input);
|
2023-07-30 19:12:25 +02:00
|
|
|
public:
|
|
|
|
enum EValidationStatus
|
|
|
|
{
|
|
|
|
PENDING,
|
|
|
|
FAILED,
|
|
|
|
PASSED
|
|
|
|
};
|
2023-09-21 04:31:08 +02:00
|
|
|
|
2023-07-30 19:12:25 +02:00
|
|
|
/// identifier, identical to name of folder with mod
|
|
|
|
std::string identifier;
|
|
|
|
|
2023-09-21 04:31:08 +02:00
|
|
|
/// detailed mod description
|
2023-07-30 19:12:25 +02:00
|
|
|
std::string description;
|
|
|
|
|
|
|
|
/// Base language of mod, all mod strings are assumed to be in this language
|
|
|
|
std::string baseLanguage;
|
|
|
|
|
|
|
|
/// vcmi versions compatible with the mod
|
|
|
|
CModVersion vcmiCompatibleMin, vcmiCompatibleMax;
|
|
|
|
|
|
|
|
/// list of mods that should be loaded before this one
|
|
|
|
std::set <TModID> dependencies;
|
|
|
|
|
|
|
|
/// list of mods that can't be used in the same time as this one
|
|
|
|
std::set <TModID> conflicts;
|
|
|
|
|
|
|
|
EValidationStatus validation;
|
|
|
|
|
|
|
|
JsonNode config;
|
|
|
|
|
|
|
|
CModInfo();
|
|
|
|
CModInfo(const std::string & identifier, const JsonNode & local, const JsonNode & config);
|
|
|
|
|
|
|
|
JsonNode saveLocalData() const;
|
|
|
|
void updateChecksum(ui32 newChecksum);
|
|
|
|
|
|
|
|
bool isEnabled() const;
|
|
|
|
|
|
|
|
static std::string getModDir(const std::string & name);
|
2023-09-01 23:26:14 +02:00
|
|
|
static JsonPath getModFile(const std::string & name);
|
2023-07-30 19:12:25 +02:00
|
|
|
|
2023-08-18 14:08:23 +02:00
|
|
|
/// return true if this mod can affect gameplay, e.g. adds or modifies any game objects
|
|
|
|
bool checkModGameplayAffecting() const;
|
2023-09-21 04:31:08 +02:00
|
|
|
|
2023-11-07 18:32:40 +02:00
|
|
|
const ModVerificationInfo & getVerificationInfo() const;
|
2023-08-18 14:08:23 +02:00
|
|
|
|
2023-07-30 19:12:25 +02:00
|
|
|
private:
|
|
|
|
/// true if mod is enabled by user, e.g. in Launcher UI
|
|
|
|
bool explicitlyEnabled;
|
|
|
|
|
|
|
|
/// true if mod can be loaded - compatible and has no missing deps
|
|
|
|
bool implicitlyEnabled;
|
2023-09-21 04:31:08 +02:00
|
|
|
|
2023-11-07 18:32:40 +02:00
|
|
|
ModVerificationInfo verificationInfo;
|
2023-07-30 19:12:25 +02:00
|
|
|
|
|
|
|
void loadLocalData(const JsonNode & data);
|
|
|
|
};
|
|
|
|
|
|
|
|
VCMI_LIB_NAMESPACE_END
|