2013-08-17 15:46:48 +03:00
|
|
|
/*
|
|
|
|
* 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
|
|
|
|
|
2015-05-26 15:12:24 +02:00
|
|
|
#include "../IHandlerBase.h"
|
2022-05-28 15:03:50 +02:00
|
|
|
#include "../int3.h"
|
|
|
|
#include "CRmgTemplate.h"
|
2013-08-17 15:46:48 +03:00
|
|
|
|
2022-07-26 15:07:42 +02:00
|
|
|
VCMI_LIB_NAMESPACE_BEGIN
|
|
|
|
|
2013-08-17 15:46:48 +03:00
|
|
|
class JsonNode;
|
|
|
|
|
2015-05-26 15:12:24 +02:00
|
|
|
/// The CJsonRmgTemplateLoader loads templates from a JSON file.
|
|
|
|
class DLL_LINKAGE CRmgTemplateStorage : public IHandlerBase
|
2013-08-17 15:46:48 +03:00
|
|
|
{
|
|
|
|
public:
|
2022-05-28 15:03:50 +02:00
|
|
|
CRmgTemplateStorage() = default;
|
|
|
|
|
2015-10-12 15:47:10 +02:00
|
|
|
std::vector<bool> getDefaultAllowed() const override;
|
2023-03-15 21:34:29 +02:00
|
|
|
std::vector<JsonNode> loadLegacyData() override;
|
2013-08-17 15:46:48 +03:00
|
|
|
|
2015-05-26 15:12:24 +02:00
|
|
|
/// loads single object into game. Scope is namespace of this object, same as name of source mod
|
2015-10-12 15:47:10 +02:00
|
|
|
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;
|
2023-07-02 09:28:51 +02:00
|
|
|
|
|
|
|
void afterLoadFinalization() override;
|
2022-05-28 15:03:50 +02:00
|
|
|
|
2022-09-19 00:46:01 +02:00
|
|
|
const CRmgTemplate* getTemplate(const std::string & templateName) const;
|
2022-05-28 15:03:50 +02:00
|
|
|
std::vector<const CRmgTemplate *> getTemplates() const;
|
2013-08-17 15:46:48 +03:00
|
|
|
|
|
|
|
private:
|
2023-09-04 23:58:08 +02:00
|
|
|
std::map<std::string, std::shared_ptr<CRmgTemplate>> templates;
|
2013-08-17 15:46:48 +03:00
|
|
|
};
|
2015-05-26 15:12:24 +02:00
|
|
|
|
2022-07-26 15:07:42 +02:00
|
|
|
|
|
|
|
VCMI_LIB_NAMESPACE_END
|