2025-05-29 18:12:54 +03:00
|
|
|
/*
|
|
|
|
* MapFormatSettings.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 "MapIdentifiersH3M.h"
|
|
|
|
#include "MapFormat.h"
|
|
|
|
#include "../campaign/CampaignConstants.h"
|
2025-05-30 18:27:54 +03:00
|
|
|
#include "../json/JsonNode.h"
|
2025-05-29 18:12:54 +03:00
|
|
|
|
|
|
|
VCMI_LIB_NAMESPACE_BEGIN
|
|
|
|
|
2025-06-02 17:24:13 +03:00
|
|
|
class MapFormatSettings : boost::noncopyable
|
2025-05-29 18:12:54 +03:00
|
|
|
{
|
|
|
|
static MapIdentifiersH3M generateMapping(EMapFormat format);
|
|
|
|
static std::map<EMapFormat, MapIdentifiersH3M> generateMappings();
|
|
|
|
static std::map<CampaignVersion, EMapFormat> generateCampaignMapping();
|
|
|
|
|
|
|
|
std::map<EMapFormat, MapIdentifiersH3M> mapping;
|
|
|
|
std::map<CampaignVersion, EMapFormat> campaignToMap;
|
2025-05-30 18:27:54 +03:00
|
|
|
|
|
|
|
JsonNode campaignOverridesConfig;
|
|
|
|
JsonNode mapOverridesConfig;
|
2025-05-29 18:12:54 +03:00
|
|
|
public:
|
|
|
|
MapFormatSettings();
|
|
|
|
|
|
|
|
bool isSupported(EMapFormat format) const
|
|
|
|
{
|
|
|
|
return mapping.count(format) != 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool isSupported(CampaignVersion format) const
|
|
|
|
{
|
|
|
|
return isSupported(campaignToMap.at(format));
|
|
|
|
}
|
|
|
|
|
|
|
|
const MapIdentifiersH3M & getMapping(EMapFormat format) const
|
|
|
|
{
|
|
|
|
return mapping.at(format);
|
|
|
|
}
|
|
|
|
|
|
|
|
const MapIdentifiersH3M & getMapping(CampaignVersion format) const
|
|
|
|
{
|
|
|
|
return mapping.at(campaignToMap.at(format));
|
|
|
|
}
|
2025-05-30 18:27:54 +03:00
|
|
|
|
2025-06-15 15:11:09 +03:00
|
|
|
const JsonNode & campaignOverrides(const std::string & campaignName)
|
2025-05-30 18:27:54 +03:00
|
|
|
{
|
|
|
|
return campaignOverridesConfig[campaignName];
|
|
|
|
}
|
|
|
|
|
2025-06-15 15:11:09 +03:00
|
|
|
const JsonNode & mapOverrides(const std::string & mapName)
|
2025-05-30 18:27:54 +03:00
|
|
|
{
|
|
|
|
return mapOverridesConfig[mapName];
|
|
|
|
}
|
2025-05-29 18:12:54 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
VCMI_LIB_NAMESPACE_END
|