1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-23 22:37:55 +02:00

Fixed hota maps templates loading

This commit is contained in:
Ivan Savenko
2023-09-20 21:59:16 +03:00
parent 921569e02e
commit 02dfecd38b
2 changed files with 8 additions and 7 deletions

View File

@@ -53,11 +53,11 @@ void MapIdentifiersH3M::loadMapping(const JsonNode & mapping)
for (auto entryTemplate : mapping["templates"].Struct()) for (auto entryTemplate : mapping["templates"].Struct())
{ {
std::string h3mName = boost::to_lower_copy(entryTemplate.second.String()); AnimationPath h3mName = AnimationPath::builtinTODO(entryTemplate.second.String());
std::string vcmiName = boost::to_lower_copy(entryTemplate.first); AnimationPath vcmiName = AnimationPath::builtinTODO(entryTemplate.first);
if (!CResourceHandler::get()->existsResource(AnimationPath::builtinTODO("SPRITES/" + vcmiName))) if (!CResourceHandler::get()->existsResource(vcmiName.addPrefix("SPRITES/")))
logMod->warn("Template animation file %s was not found!", vcmiName); logMod->warn("Template animation file %s was not found!", vcmiName.getOriginalName());
mappingObjectTemplate[h3mName] = vcmiName; mappingObjectTemplate[h3mName] = vcmiName;
} }
@@ -108,10 +108,10 @@ void MapIdentifiersH3M::loadMapping(const JsonNode & mapping)
void MapIdentifiersH3M::remapTemplate(ObjectTemplate & objectTemplate) void MapIdentifiersH3M::remapTemplate(ObjectTemplate & objectTemplate)
{ {
std::string name = boost::to_lower_copy(objectTemplate.animationFile.getName()); auto name = objectTemplate.animationFile;
if (mappingObjectTemplate.count(name)) if (mappingObjectTemplate.count(name))
objectTemplate.animationFile = AnimationPath::builtinTODO(mappingObjectTemplate.at(name)); objectTemplate.animationFile = mappingObjectTemplate.at(name);
ObjectTypeIdentifier objectType{ objectTemplate.id, objectTemplate.subid}; ObjectTypeIdentifier objectType{ objectTemplate.id, objectTemplate.subid};

View File

@@ -11,6 +11,7 @@
#pragma once #pragma once
#include "../GameConstants.h" #include "../GameConstants.h"
#include "../filesystem/ResourcePath.h"
VCMI_LIB_NAMESPACE_BEGIN VCMI_LIB_NAMESPACE_BEGIN
@@ -43,7 +44,7 @@ class MapIdentifiersH3M
std::map<ArtifactID, ArtifactID> mappingArtifact; std::map<ArtifactID, ArtifactID> mappingArtifact;
std::map<SecondarySkill, SecondarySkill> mappingSecondarySkill; std::map<SecondarySkill, SecondarySkill> mappingSecondarySkill;
std::map<std::string, std::string> mappingObjectTemplate; std::map<AnimationPath, AnimationPath> mappingObjectTemplate;
std::map<ObjectTypeIdentifier, ObjectTypeIdentifier> mappingObjectIndex; std::map<ObjectTypeIdentifier, ObjectTypeIdentifier> mappingObjectIndex;
template<typename IdentifierID> template<typename IdentifierID>