2023-05-23 14:07:44 +02:00
|
|
|
/*
|
|
|
|
* MapIdentifiersH3M.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 "../GameConstants.h"
|
|
|
|
|
|
|
|
VCMI_LIB_NAMESPACE_BEGIN
|
|
|
|
|
|
|
|
class JsonNode;
|
2023-05-24 21:02:27 +02:00
|
|
|
class ObjectTemplate;
|
|
|
|
|
|
|
|
struct ObjectTypeIdentifier
|
|
|
|
{
|
|
|
|
Obj ID;
|
|
|
|
int32_t subID;
|
|
|
|
|
|
|
|
bool operator < (const ObjectTypeIdentifier & other) const
|
|
|
|
{
|
|
|
|
if (ID != other.ID)
|
|
|
|
return ID < other.ID;
|
|
|
|
return subID < other.subID;
|
|
|
|
}
|
|
|
|
};
|
2023-05-23 14:07:44 +02:00
|
|
|
|
|
|
|
class MapIdentifiersH3M
|
|
|
|
{
|
|
|
|
std::map<BuildingID, BuildingID> mappingBuilding;
|
|
|
|
std::map<FactionID, std::map<BuildingID, BuildingID>> mappingFactionBuilding;
|
2023-05-23 22:55:18 +02:00
|
|
|
std::map<FactionID, FactionID> mappingFaction;
|
|
|
|
std::map<CreatureID, CreatureID> mappingCreature;
|
|
|
|
std::map<HeroTypeID, HeroTypeID> mappingHeroType;
|
2023-06-20 14:09:42 +02:00
|
|
|
std::map<int32_t, int32_t> mappingHeroPortrait;
|
2023-05-23 22:55:18 +02:00
|
|
|
std::map<HeroClassID, HeroClassID> mappingHeroClass;
|
|
|
|
std::map<TerrainId, TerrainId> mappingTerrain;
|
|
|
|
std::map<ArtifactID, ArtifactID> mappingArtifact;
|
|
|
|
std::map<SecondarySkill, SecondarySkill> mappingSecondarySkill;
|
|
|
|
|
2023-05-24 21:02:27 +02:00
|
|
|
std::map<std::string, std::string> mappingObjectTemplate;
|
|
|
|
std::map<ObjectTypeIdentifier, ObjectTypeIdentifier> mappingObjectIndex;
|
|
|
|
|
2023-05-23 22:55:18 +02:00
|
|
|
template<typename IdentifierID>
|
2023-05-25 23:38:00 +02:00
|
|
|
void loadMapping(std::map<IdentifierID, IdentifierID> & result, const JsonNode & mapping, const std::string & identifierName);
|
2023-05-23 14:07:44 +02:00
|
|
|
public:
|
|
|
|
void loadMapping(const JsonNode & mapping);
|
|
|
|
|
2023-05-24 21:02:27 +02:00
|
|
|
void remapTemplate(ObjectTemplate & objectTemplate);
|
|
|
|
|
2023-05-23 15:13:09 +02:00
|
|
|
BuildingID remapBuilding(std::optional<FactionID> owner, BuildingID input) const;
|
2023-06-20 14:09:42 +02:00
|
|
|
int32_t remapPortrrait(int32_t input) const;
|
2023-05-23 22:55:18 +02:00
|
|
|
FactionID remap(FactionID input) const;
|
|
|
|
CreatureID remap(CreatureID input) const;
|
|
|
|
HeroTypeID remap(HeroTypeID input) const;
|
|
|
|
HeroClassID remap(HeroClassID input) const;
|
|
|
|
TerrainId remap(TerrainId input) const;
|
|
|
|
ArtifactID remap(ArtifactID input) const;
|
|
|
|
SecondarySkill remap(SecondarySkill input) const;
|
2023-06-20 14:09:42 +02:00
|
|
|
|
2023-05-23 14:07:44 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
VCMI_LIB_NAMESPACE_END
|