1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-22 22:13:35 +02:00
vcmi/lib/rmg/CRmgTemplateStorage.h

45 lines
1.2 KiB
C++
Raw Normal View History

/*
* 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"
VCMI_LIB_NAMESPACE_BEGIN
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;
2023-03-15 21:34:29 +02:00
std::vector<JsonNode> loadLegacyData() 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;
void afterLoadFinalization() override;
const CRmgTemplate* getTemplate(const std::string & templateName) const;
std::vector<const CRmgTemplate *> getTemplates() const;
private:
2023-09-04 23:58:08 +02:00
std::map<std::string, std::shared_ptr<CRmgTemplate>> templates;
};
VCMI_LIB_NAMESPACE_END