1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-15 00:05:02 +02:00

Docs & final touches

This commit is contained in:
Tomasz Zieliński
2024-04-12 14:53:07 +02:00
parent be9813b4fb
commit a7d0f0626a
6 changed files with 28 additions and 16 deletions

View File

@ -212,18 +212,26 @@ TObjectTypeHandler CObjectClassesHandler::loadSubObjectFromJson(const std::strin
createdObject->subtype = index;
createdObject->init(entry);
for (auto & templ : createdObject->getTemplates())
bool staticObject = createdObject->isStaticObject();
if (staticObject)
{
// Register templates for new objects from mods
VLC->biomeHandler->addTemplate(scope, templ->stringID, templ);
for (auto & templ : createdObject->getTemplates())
{
// Register templates for new objects from mods
VLC->biomeHandler->addTemplate(scope, templ->stringID, templ);
}
}
auto range = legacyTemplates.equal_range(std::make_pair(obj->id, index));
for (auto & templ : boost::make_iterator_range(range.first, range.second))
{
// Register legacy templates as "core"
VLC->biomeHandler->addTemplate("core", templ.second->stringID, templ.second);
// FIXME: Why does it clear stringID?
if (staticObject)
{
// Register legacy templates as "core"
// FIXME: Why does it clear stringID?
VLC->biomeHandler->addTemplate("core", templ.second->stringID, templ.second);
}
createdObject->addTemplate(templ.second);
}