mirror of
https://github.com/vcmi/vcmi.git
synced 2025-04-13 11:40:38 +02:00
Fix buildings loading
This commit is contained in:
parent
3519fd8302
commit
fce5f9f907
@ -135,14 +135,14 @@ MapFormatFeaturesH3M MapFormatFeaturesH3M::getFeaturesHOTA(uint32_t hotaVersion)
|
|||||||
if(hotaVersion < 3)
|
if(hotaVersion < 3)
|
||||||
{
|
{
|
||||||
result.artifactsCount = 163; // + HotA artifacts
|
result.artifactsCount = 163; // + HotA artifacts
|
||||||
result.heroesCount = 178; // + Cove
|
result.heroesCount = 176; // + Cove
|
||||||
result.heroesPortraitsCount = 187; // + Cove
|
result.heroesPortraitsCount = 187; // + Cove
|
||||||
}
|
}
|
||||||
if(hotaVersion == 3)
|
if(hotaVersion == 3)
|
||||||
{
|
{
|
||||||
result.artifactsCount = 165; // + HotA artifacts
|
result.artifactsCount = 165; // + HotA artifacts
|
||||||
result.heroesCount = 179; // + Cove
|
result.heroesCount = 177; // + Cove + Giselle
|
||||||
result.heroesPortraitsCount = 187; // + Cove
|
result.heroesPortraitsCount = 188; // + Cove + Giselle
|
||||||
}
|
}
|
||||||
|
|
||||||
assert((result.heroesCount + 7) / 8 == result.heroesBytes);
|
assert((result.heroesCount + 7) / 8 == result.heroesBytes);
|
||||||
|
@ -21,10 +21,8 @@
|
|||||||
VCMI_LIB_NAMESPACE_BEGIN
|
VCMI_LIB_NAMESPACE_BEGIN
|
||||||
|
|
||||||
template<typename IdentifierID>
|
template<typename IdentifierID>
|
||||||
std::map<IdentifierID, IdentifierID> MapIdentifiersH3M::loadMapping(const JsonNode & mapping, const std::string & identifierName)
|
void MapIdentifiersH3M::loadMapping(std::map<IdentifierID, IdentifierID> & result, const JsonNode & mapping, const std::string & identifierName)
|
||||||
{
|
{
|
||||||
std::map<IdentifierID, IdentifierID> result;
|
|
||||||
|
|
||||||
for (auto entry : mapping.Struct())
|
for (auto entry : mapping.Struct())
|
||||||
{
|
{
|
||||||
IdentifierID sourceID (entry.second.Integer());
|
IdentifierID sourceID (entry.second.Integer());
|
||||||
@ -32,8 +30,6 @@ std::map<IdentifierID, IdentifierID> MapIdentifiersH3M::loadMapping(const JsonNo
|
|||||||
|
|
||||||
result[sourceID] = targetID;
|
result[sourceID] = targetID;
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MapIdentifiersH3M::loadMapping(const JsonNode & mapping)
|
void MapIdentifiersH3M::loadMapping(const JsonNode & mapping)
|
||||||
@ -88,14 +84,14 @@ void MapIdentifiersH3M::loadMapping(const JsonNode & mapping)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mappingBuilding = loadMapping<BuildingID>(mapping["buildingsCommon"], "building.core:random");
|
loadMapping(mappingBuilding, mapping["buildingsCommon"], "building.core:random");
|
||||||
mappingFaction = loadMapping<FactionID>(mapping["factions"], "faction");
|
loadMapping(mappingFaction, mapping["factions"], "faction");
|
||||||
mappingCreature = loadMapping<CreatureID>(mapping["creatures"], "creature");
|
loadMapping(mappingCreature, mapping["creatures"], "creature");
|
||||||
mappingHeroType = loadMapping<HeroTypeID>(mapping["heroes"], "hero");
|
loadMapping(mappingHeroType, mapping["heroes"], "hero");
|
||||||
mappingHeroClass = loadMapping<HeroClassID>(mapping["heroClasses"], "heroClass");
|
loadMapping(mappingHeroClass, mapping["heroClasses"], "heroClass");
|
||||||
mappingTerrain = loadMapping<TerrainId>(mapping["terrains"], "terrain");
|
loadMapping(mappingTerrain, mapping["terrains"], "terrain");
|
||||||
mappingArtifact = loadMapping<ArtifactID>(mapping["artifacts"], "artifact");
|
loadMapping(mappingArtifact, mapping["artifacts"], "artifact");
|
||||||
mappingSecondarySkill = loadMapping<SecondarySkill>(mapping["skills"], "skill");
|
loadMapping(mappingSecondarySkill, mapping["skills"], "skill");
|
||||||
}
|
}
|
||||||
|
|
||||||
void MapIdentifiersH3M::remapTemplate(ObjectTemplate & objectTemplate)
|
void MapIdentifiersH3M::remapTemplate(ObjectTemplate & objectTemplate)
|
||||||
|
@ -46,7 +46,7 @@ class MapIdentifiersH3M
|
|||||||
std::map<ObjectTypeIdentifier, ObjectTypeIdentifier> mappingObjectIndex;
|
std::map<ObjectTypeIdentifier, ObjectTypeIdentifier> mappingObjectIndex;
|
||||||
|
|
||||||
template<typename IdentifierID>
|
template<typename IdentifierID>
|
||||||
std::map<IdentifierID, IdentifierID> loadMapping(const JsonNode & mapping, const std::string & identifierName);
|
void loadMapping(std::map<IdentifierID, IdentifierID> & result, const JsonNode & mapping, const std::string & identifierName);
|
||||||
public:
|
public:
|
||||||
void loadMapping(const JsonNode & mapping);
|
void loadMapping(const JsonNode & mapping);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user