Beispiel #1
0
void CHeroHandler::loadObject(std::string scope, std::string name, const JsonNode & data)
{
	auto object = loadFromJson(data);
	object->ID = HeroTypeID(heroes.size());
	object->imageIndex = heroes.size() + 10; // 2 special frames + some extra portraits

	heroes.push_back(object);

	VLC->modh->identifiers.registerObject(scope, "hero", name, object->ID.getNum());
}
Beispiel #2
0
void CHeroInstanceConstructor::afterLoadFinalization()
{
    for (auto entry : filtersJson.Struct())
    {
        filters[entry.first] = LogicalExpression<HeroTypeID>(entry.second, [this](const JsonNode & node)
        {
            return HeroTypeID(VLC->modh->identifiers.getIdentifier("hero", node.Vector()[0]).get());
        });
    }
}
Beispiel #3
0
void CHeroHandler::loadObject(std::string scope, std::string name, const JsonNode & data, size_t index)
{
	auto object = loadFromJson(data);
	object->ID = HeroTypeID(index);
	object->imageIndex = index;

	assert(heroes[index] == nullptr); // ensure that this id was not loaded before
	heroes[index] = object;

	VLC->modh->identifiers.registerObject(scope, "hero", name, object->ID.getNum());
}