Przeglądaj źródła

Fixed hota maps templates loading

Ivan Savenko 2 lat temu
rodzic
commit
02dfecd38b

+ 6 - 6
lib/mapping/MapIdentifiersH3M.cpp

@@ -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());
-		std::string vcmiName = boost::to_lower_copy(entryTemplate.first);
+		AnimationPath h3mName = AnimationPath::builtinTODO(entryTemplate.second.String());
+		AnimationPath vcmiName = AnimationPath::builtinTODO(entryTemplate.first);
 
 
-		if (!CResourceHandler::get()->existsResource(AnimationPath::builtinTODO("SPRITES/" + vcmiName)))
-			logMod->warn("Template animation file %s was not found!", vcmiName);
+		if (!CResourceHandler::get()->existsResource(vcmiName.addPrefix("SPRITES/")))
+			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};
 
 

+ 2 - 1
lib/mapping/MapIdentifiersH3M.h

@@ -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>