1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-29 23:07:48 +02:00

Redone RMG template serialization using JSON serializer, added tests

This commit is contained in:
AlexVinS
2018-03-09 21:11:20 +03:00
parent 7d27d144a5
commit 9d108d59db
25 changed files with 991 additions and 718 deletions

View File

@@ -10,12 +10,10 @@
#pragma once
#include "CRmgTemplate.h"
#include "../IHandlerBase.h"
class JsonNode;
typedef std::vector<JsonNode> JsonVector;
class CRmgTemplate;
/// The CJsonRmgTemplateLoader loads templates from a JSON file.
class DLL_LINKAGE CRmgTemplateStorage : public IHandlerBase
@@ -34,14 +32,6 @@ public:
virtual void loadObject(std::string scope, std::string name, const JsonNode & data, size_t index) override;
private:
CRmgTemplate::CSize parseMapTemplateSize(const std::string & text) const;
rmg::ZoneOptions::CTownInfo parseTemplateZoneTowns(const JsonNode & node) const;
ETemplateZoneType::ETemplateZoneType parseZoneType(const std::string & type) const;
std::set<TFaction> parseTownTypes(const JsonVector & townTypesVector, const std::set<TFaction> & defaultTownTypes) const;
std::set<ETerrainType> parseTerrainTypes(const JsonVector & terTypeStrings, const std::set<ETerrainType> & defaultTerrainTypes) const;
CRmgTemplate::CPlayerCountRange parsePlayers(const std::string & players) const;
protected:
std::map<std::string, CRmgTemplate *> templates;
};