1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-20 20:23:03 +02:00
vcmi/lib/rmg/CRmgTemplateStorage.h
Nordsoft91 9d06e51631
Place proper towns in underground (#743)
Implement feature of proper town selection in underground and surface
* Some minor refactoring of rmg
2022-05-28 16:03:50 +03:00

40 lines
1.2 KiB
C++

/*
* CRmgTemplateStorage.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
#include "../IHandlerBase.h"
#include "../int3.h"
#include "CRmgTemplate.h"
class JsonNode;
/// The CJsonRmgTemplateLoader loads templates from a JSON file.
class DLL_LINKAGE CRmgTemplateStorage : public IHandlerBase
{
public:
CRmgTemplateStorage() = default;
std::vector<bool> getDefaultAllowed() const override;
std::vector<JsonNode> loadLegacyData(size_t dataSize) override;
/// loads single object into game. Scope is namespace of this object, same as name of source mod
virtual void loadObject(std::string scope, std::string name, const JsonNode & data) override;
virtual void loadObject(std::string scope, std::string name, const JsonNode & data, size_t index) override;
const CRmgTemplate * getTemplate(const std::string & templateName) const;
std::vector<const CRmgTemplate *> getTemplates() const;
std::vector<const CRmgTemplate *> getTemplates(const int3& filterSize, si8 filterPlayers, si8 filterHumanPlayers, si8 filterCpuPlayers) const;
private:
std::map<std::string, CRmgTemplate> templates;
};