mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-23 22:37:55 +02:00
Implemented mapping of hero portraits
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
#include "../VCMI_Lib.h"
|
||||
#include "../CModHandler.h"
|
||||
#include "../CTownHandler.h"
|
||||
#include "../CHeroHandler.h"
|
||||
#include "../filesystem/Filesystem.h"
|
||||
#include "../mapObjectConstructors/AObjectTypeHandler.h"
|
||||
#include "../mapObjectConstructors/CObjectClassesHandler.h"
|
||||
@@ -86,6 +87,15 @@ void MapIdentifiersH3M::loadMapping(const JsonNode & mapping)
|
||||
}
|
||||
}
|
||||
|
||||
for (auto entry : mapping["portraits"].Struct())
|
||||
{
|
||||
int32_t sourceID = entry.second.Integer();
|
||||
int32_t targetID = *VLC->modh->identifiers.getIdentifier(VLC->modh->scopeGame(), "hero", entry.first);
|
||||
int32_t iconID = VLC->heroTypes()->getByIndex(targetID)->getIconIndex();
|
||||
|
||||
mappingHeroPortrait[sourceID] = iconID;
|
||||
}
|
||||
|
||||
loadMapping(mappingBuilding, mapping["buildingsCommon"], "building.core:random");
|
||||
loadMapping(mappingFaction, mapping["factions"], "faction");
|
||||
loadMapping(mappingCreature, mapping["creatures"], "creature");
|
||||
@@ -158,6 +168,13 @@ HeroTypeID MapIdentifiersH3M::remap(HeroTypeID input) const
|
||||
return input;
|
||||
}
|
||||
|
||||
int32_t MapIdentifiersH3M::remapPortrrait(int32_t input) const
|
||||
{
|
||||
if (mappingHeroPortrait.count(input))
|
||||
return mappingHeroPortrait.at(input);
|
||||
return input;
|
||||
}
|
||||
|
||||
HeroClassID MapIdentifiersH3M::remap(HeroClassID input) const
|
||||
{
|
||||
if (mappingHeroClass.count(input))
|
||||
|
||||
Reference in New Issue
Block a user