mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-29 23:07:48 +02:00
First part of submods support.
- VCMI will load mods from Mods directory recursively. Submods must be placed into additional Mods directory, e.g. <data dir>/Mods/<mod name>/Mods/<submod name> - submods will be loaded only if their parent mod was enabled - submods namespace for objects will be "<parent mod ID>.<submod ID>" - TODO: Launcher is not aware of submods yet (seems to be working but may behave incorrectly)
This commit is contained in:
@@ -177,9 +177,12 @@ public:
|
||||
CModInfo(){}
|
||||
CModInfo(std::string identifier, const JsonNode & local, const JsonNode & config);
|
||||
|
||||
JsonNode saveLocalData();
|
||||
JsonNode saveLocalData() const;
|
||||
void updateChecksum(ui32 newChecksum);
|
||||
|
||||
static std::string getModDir(std::string name);
|
||||
static std::string getModFile(std::string name);
|
||||
|
||||
template <typename Handler> void serialize(Handler &h, const int version)
|
||||
{
|
||||
h & identifier & description & name;
|
||||
@@ -197,7 +200,6 @@ class DLL_LINKAGE CModHandler
|
||||
CModInfo coreMod;
|
||||
|
||||
void loadConfigFromFile(std::string name);
|
||||
void loadModFilesystems();
|
||||
|
||||
bool hasCircularDependency(TModID mod, std::set <TModID> currentList = std::set <TModID>()) const;
|
||||
|
||||
@@ -210,16 +212,24 @@ class DLL_LINKAGE CModHandler
|
||||
// returns load order in which all dependencies are resolved, e.g. loaded after required mods
|
||||
// function assumes that input list is valid (checkDependencies returned true)
|
||||
std::vector <TModID> resolveDependencies(std::vector<TModID> input) const;
|
||||
|
||||
std::vector<std::string> getModList(std::string path);
|
||||
void loadMods(std::string path, std::string namePrefix, const JsonNode & modSettings);
|
||||
public:
|
||||
|
||||
CIdentifierStorage identifiers;
|
||||
|
||||
/// receives list of available mods and trying to load mod.json from all of them
|
||||
void initializeMods(std::vector<std::string> availableMods);
|
||||
void initializeConfig();
|
||||
void loadMods();
|
||||
void loadModFilesystems();
|
||||
|
||||
CModInfo & getModData(TModID modId);
|
||||
|
||||
/// returns list of all (active) mods
|
||||
std::vector<std::string> getAllMods();
|
||||
std::vector<std::string> getActiveMods();
|
||||
|
||||
/// load content from all available mods
|
||||
void load();
|
||||
void afterLoad();
|
||||
|
||||
Reference in New Issue
Block a user