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

vcmi: use enum class for EComponentType

There is really no reason not to use it
This commit is contained in:
Konstantin
2023-03-10 15:54:12 +03:00
parent 2bd74e5c67
commit bc228a938a
15 changed files with 148 additions and 86 deletions

View File

@ -432,36 +432,36 @@ void CRewardInfo::loadComponents(std::vector<Component> & comps,
if (heroExperience)
{
comps.emplace_back(Component::EXPERIENCE, 0, static_cast<si32>(h->calculateXp(heroExperience)), 0);
comps.emplace_back(Component::EComponentType::EXPERIENCE, 0, static_cast<si32>(h->calculateXp(heroExperience)), 0);
}
if (heroLevel)
comps.emplace_back(Component::EXPERIENCE, 1, heroLevel, 0);
comps.emplace_back(Component::EComponentType::EXPERIENCE, 1, heroLevel, 0);
if (manaDiff || manaPercentage >= 0)
comps.emplace_back(Component::PRIM_SKILL, 5, calculateManaPoints(h) - h->mana, 0);
comps.emplace_back(Component::EComponentType::PRIM_SKILL, 5, calculateManaPoints(h) - h->mana, 0);
for (size_t i=0; i<primary.size(); i++)
{
if (primary[i] != 0)
comps.emplace_back(Component::PRIM_SKILL, static_cast<ui16>(i), primary[i], 0);
comps.emplace_back(Component::EComponentType::PRIM_SKILL, static_cast<ui16>(i), primary[i], 0);
}
for(const auto & entry : secondary)
comps.emplace_back(Component::SEC_SKILL, entry.first, entry.second, 0);
comps.emplace_back(Component::EComponentType::SEC_SKILL, entry.first, entry.second, 0);
for(const auto & entry : artifacts)
comps.emplace_back(Component::ARTIFACT, entry, 1, 0);
comps.emplace_back(Component::EComponentType::ARTIFACT, entry, 1, 0);
for(const auto & entry : spells)
comps.emplace_back(Component::SPELL, entry, 1, 0);
comps.emplace_back(Component::EComponentType::SPELL, entry, 1, 0);
for(const auto & entry : creatures)
comps.emplace_back(Component::CREATURE, entry.type->idNumber, entry.count, 0);
comps.emplace_back(Component::EComponentType::CREATURE, entry.type->idNumber, entry.count, 0);
for (size_t i=0; i<resources.size(); i++)
{
if (resources[i] !=0)
comps.emplace_back(Component::RESOURCE, static_cast<ui16>(i), resources[i], 0);
comps.emplace_back(Component::EComponentType::RESOURCE, static_cast<ui16>(i), resources[i], 0);
}
}