1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-28 08:48:48 +02:00

vcmi: use entilites when possible part 1

This commit is contained in:
Konstantin 2023-03-27 14:56:39 +03:00
parent 4259d116e1
commit 22dd97ad18
7 changed files with 9 additions and 9 deletions

View File

@ -60,7 +60,7 @@ std::string AbstractGoal::toString() const //TODO: virtualize
desc = "GATHER TROOPS";
break;
case GET_ART_TYPE:
desc = "GET ARTIFACT OF TYPE " + VLC->arth->objects[aid]->getNameTranslated();
desc = "GET ARTIFACT OF TYPE " + VLC->artifacts()->getByIndex(aid)->getNameTranslated();
break;
case DIG_AT_TILE:
desc = "DIG AT TILE " + tile.toString();

View File

@ -76,7 +76,7 @@ std::string HeroTypeID::encode(const si32 index)
const CArtifact * ArtifactID::toArtifact() const
{
return VLC->arth->objects.at(*this);
return dynamic_cast<const CArtifact*>(toArtifact(VLC->artifacts()));
}
const Artifact * ArtifactID::toArtifact(const ArtifactService * service) const

View File

@ -1700,7 +1700,7 @@ std::string Bonus::nameForBonus() const
case Bonus::SPECIAL_PECULIAR_ENCHANT:
case Bonus::SPECIAL_ADD_VALUE_ENCHANT:
case Bonus::SPECIAL_FIXED_VALUE_ENCHANT:
return (*VLC->spellh)[static_cast<SpellID::ESpellID>(subtype)]->identifier;
return VLC->spells()->getByIndex(subtype)->getJsonKey();
case Bonus::SPECIAL_UPGRADE:
return CreatureID::encode(subtype) + "2" + CreatureID::encode(additionalInfo[0]);
case Bonus::GENERATE_RESOURCE:

View File

@ -183,7 +183,7 @@ namespace JsonRandom
vstd::erase_if(spells, [=](const SpellID & spell)
{
return VLC->spellh->objects[spell]->level != si32(value["level"].Float());
return VLC->spellh->getById(spell)->getLevel() != si32(value["level"].Float());
});
return SpellID(*RandomGeneratorUtil::nextItem(spells, rng));

View File

@ -204,7 +204,7 @@ std::string CSpell::getDescriptionTranslated(int32_t level) const
std::string CSpell::getJsonKey() const
{
return modScope + ':' + identifier;;
return modScope + ':' + identifier;
}
int32_t CSpell::getIndex() const

View File

@ -289,7 +289,7 @@ void Inspector::updateProperties(CGArtifact * o)
//if(map->isAllowedSpell(spell->id))
delegate->options << QObject::tr(spell->getJsonKey().c_str());
}
addProperty("Spell", VLC->spellh->objects[spellId]->getJsonKey(), delegate, false);
addProperty("Spell", VLC->spellh->getById(spellId)->getJsonKey(), delegate, false);
}
}
}

View File

@ -74,7 +74,7 @@ QList<QString> RewardsWidget::getListForType(RewardType typeId)
for(int i = 0; i < map.allowedAbilities.size(); ++i)
{
if(map.allowedAbilities[i])
result.append(QString::fromStdString(VLC->skillh->objects.at(i)->getNameTranslated()));
result.append(QString::fromStdString(VLC->skills()->getByIndex(i)->getNameTranslated()));
}
break;
@ -82,7 +82,7 @@ QList<QString> RewardsWidget::getListForType(RewardType typeId)
for(int i = 0; i < map.allowedArtifact.size(); ++i)
{
if(map.allowedArtifact[i])
result.append(QString::fromStdString(VLC->arth->objects.at(i)->getNameTranslated()));
result.append(QString::fromStdString(VLC->artifacts()->getByIndex(i)->getNameTranslated()));
}
break;
@ -90,7 +90,7 @@ QList<QString> RewardsWidget::getListForType(RewardType typeId)
for(int i = 0; i < map.allowedSpell.size(); ++i)
{
if(map.allowedSpell[i])
result.append(QString::fromStdString(VLC->spellh->objects.at(i)->getNameTranslated()));
result.append(QString::fromStdString(VLC->spells()->getByIndex(i)->getNameTranslated()));
}
break;