2012-08-10 18:16:42 +03:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "Filesystem/CResourceLoader.h"
|
2012-08-10 16:07:53 +03:00
|
|
|
|
|
|
|
#include "VCMI_Lib.h"
|
|
|
|
#include "CCreatureHandler.h"
|
|
|
|
#include "CArtHandler.h"
|
2012-09-23 17:32:49 +03:00
|
|
|
#include "CTownHandler.h"
|
2012-08-10 16:07:53 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* CModHandler.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
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
class CModHandler;
|
|
|
|
class CModIndentifier;
|
|
|
|
class CModInfo;
|
2012-11-13 14:52:23 +03:00
|
|
|
class JsonNode;
|
2012-08-10 16:07:53 +03:00
|
|
|
|
2012-11-13 14:52:23 +03:00
|
|
|
typedef si32 TModID;
|
2012-08-10 16:07:53 +03:00
|
|
|
|
|
|
|
class DLL_LINKAGE CModInfo
|
|
|
|
{
|
|
|
|
public:
|
2012-11-13 14:52:23 +03:00
|
|
|
/// TODO: list of mods that should be loaded before this one
|
|
|
|
std::vector <TModID> requirements;
|
2012-08-10 16:07:53 +03:00
|
|
|
|
2012-11-13 14:52:23 +03:00
|
|
|
/// mod configuration (mod.json).
|
2012-11-13 15:55:47 +03:00
|
|
|
std::shared_ptr<JsonNode> config; //TODO: unique_ptr can't be serialized
|
2012-08-10 16:07:53 +03:00
|
|
|
|
|
|
|
template <typename Handler> void serialize(Handler &h, const int version)
|
|
|
|
{
|
2012-11-13 14:52:23 +03:00
|
|
|
h & requirements & config;
|
2012-08-10 16:07:53 +03:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
class DLL_LINKAGE CModHandler
|
|
|
|
{
|
|
|
|
public:
|
2012-11-13 14:52:23 +03:00
|
|
|
//std::string currentConfig; //save settings in this file
|
2012-08-10 16:07:53 +03:00
|
|
|
|
2012-11-13 14:52:23 +03:00
|
|
|
std::map <TModID, CModInfo> allMods;
|
|
|
|
std::set <TModID> activeMods;//TODO: use me
|
2012-08-10 16:07:53 +03:00
|
|
|
|
2012-11-13 14:52:23 +03:00
|
|
|
/// management of game settings config
|
|
|
|
void loadConfigFromFile (std::string name);
|
2012-08-10 16:07:53 +03:00
|
|
|
void saveConfigToFile (std::string name);
|
2012-11-13 14:52:23 +03:00
|
|
|
|
|
|
|
/// find all available mods and load them into FS
|
|
|
|
void findAvailableMods();
|
|
|
|
|
|
|
|
/// load content from all available mods
|
|
|
|
void loadActiveMods();
|
|
|
|
|
|
|
|
/// actions that should be triggered on map restart
|
|
|
|
/// TODO: merge into appropriate handlers?
|
|
|
|
void reload();
|
2012-08-10 16:07:53 +03:00
|
|
|
|
2012-08-11 12:06:23 +03:00
|
|
|
struct DLL_LINKAGE hardcodedFeatures
|
|
|
|
{
|
|
|
|
int CREEP_SIZE; // neutral stacks won't grow beyond this number
|
|
|
|
int WEEKLY_GROWTH; //percent
|
|
|
|
int NEUTRAL_STACK_EXP;
|
2012-09-05 15:49:23 +03:00
|
|
|
int MAX_BUILDING_PER_TURN;
|
2012-08-11 12:06:23 +03:00
|
|
|
bool DWELLINGS_ACCUMULATE_CREATURES;
|
|
|
|
bool ALL_CREATURES_GET_DOUBLE_MONTHS;
|
|
|
|
|
|
|
|
template <typename Handler> void serialize(Handler &h, const int version)
|
|
|
|
{
|
|
|
|
h & CREEP_SIZE & WEEKLY_GROWTH & NEUTRAL_STACK_EXP;
|
|
|
|
h & DWELLINGS_ACCUMULATE_CREATURES & ALL_CREATURES_GET_DOUBLE_MONTHS;
|
|
|
|
}
|
|
|
|
} settings;
|
|
|
|
|
2012-08-24 12:37:52 +03:00
|
|
|
struct DLL_LINKAGE gameModules
|
|
|
|
{
|
|
|
|
bool STACK_EXP;
|
|
|
|
bool STACK_ARTIFACT;
|
|
|
|
bool COMMANDERS;
|
|
|
|
bool MITHRIL;
|
|
|
|
|
|
|
|
template <typename Handler> void serialize(Handler &h, const int version)
|
|
|
|
{
|
|
|
|
h & STACK_EXP & STACK_ARTIFACT & COMMANDERS & MITHRIL;
|
|
|
|
}
|
|
|
|
} modules;
|
|
|
|
|
2012-08-10 16:07:53 +03:00
|
|
|
CModHandler();
|
|
|
|
|
|
|
|
template <typename Handler> void serialize(Handler &h, const int version)
|
|
|
|
{
|
2012-08-24 12:37:52 +03:00
|
|
|
h & allMods & activeMods & settings & modules;
|
2012-08-10 16:07:53 +03:00
|
|
|
}
|
2012-08-10 18:16:42 +03:00
|
|
|
};
|