1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-03-25 21:38:59 +02:00

Fixed mapping of hota objects

This commit is contained in:
Ivan Savenko 2023-05-25 19:35:21 +03:00
parent 952708e865
commit 312b703a78
6 changed files with 17 additions and 5 deletions

View File

@ -57,6 +57,7 @@ void CRewardableConstructor::configureObject(CGObjectInstance * object, CRandomG
rewardInfo.reward.extraComponents.emplace_back(Component::EComponentType::LUCK, 0, bonus.val, 0);
}
}
assert(!rewardableObject->configuration.info.empty());
}
}

View File

@ -338,7 +338,8 @@ CGObjectInstance * MarketInstanceConstructor::create(std::shared_ptr<const Objec
if(!title.empty())
market->title = VLC->generaltexth->translate(title);
market->speech = VLC->generaltexth->translate(speech);
if (!speech.empty())
market->speech = VLC->generaltexth->translate(speech);
return market;
}

View File

@ -922,8 +922,7 @@ void CMapLoaderH3M::readObjectTemplates()
// Read custom defs
for(int defID = 0; defID < defAmount; ++defID)
{
auto tmpl = std::make_shared<ObjectTemplate>();
tmpl->readMap(reader->getInternalReader());
auto tmpl = reader->readObjectTemplate();
templates.push_back(tmpl);
if (!CResourceHandler::get()->existsResource(ResourceID( "SPRITES/" + tmpl->animationFile, EResType::ANIMATION)))

View File

@ -54,8 +54,8 @@ void MapIdentifiersH3M::loadMapping(const JsonNode & mapping)
for (auto entryTemplate : mapping["templates"].Struct())
{
std::string h3mName = entryTemplate.second.String();
std::string vcmiName = entryTemplate.first;
std::string h3mName = boost::to_lower_copy(entryTemplate.second.String());
std::string vcmiName = boost::to_lower_copy(entryTemplate.first);
if (!CResourceHandler::get()->existsResource(ResourceID( "SPRITES/" + vcmiName, EResType::ANIMATION)))
logMod->warn("Template animation file %s was not found!", vcmiName);

View File

@ -13,6 +13,7 @@
#include "../filesystem/CBinaryReader.h"
#include "../int3.h"
#include "../mapObjects/ObjectTemplate.h"
VCMI_LIB_NAMESPACE_BEGIN
@ -315,6 +316,14 @@ int3 MapReaderH3M::readInt3()
return p;
}
std::shared_ptr<ObjectTemplate> MapReaderH3M::readObjectTemplate()
{
auto tmpl = std::make_shared<ObjectTemplate>();
tmpl->readMap(*reader);
remapper.remapTemplate(*tmpl);
return tmpl;
}
void MapReaderH3M::skipUnused(size_t amount)
{
reader->skip(amount);

View File

@ -59,6 +59,8 @@ public:
int3 readInt3();
std::shared_ptr<ObjectTemplate> readObjectTemplate();
void skipUnused(size_t amount);
void skipZero(size_t amount);