1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-29 23:07:48 +02:00

Moved checks for campaign heroes to CGHeroInstance class

This commit is contained in:
Ivan Savenko
2024-01-30 23:33:58 +02:00
parent 5d8b65befd
commit 3abc26e789
5 changed files with 46 additions and 5 deletions

View File

@@ -1799,4 +1799,40 @@ void CGHeroInstance::fillUpgradeInfo(UpgradeInfo & info, const CStackInstance &s
}
}
bool CGHeroInstance::isCampaignYog() const
{
const StartInfo *si = cb->getStartInfo();
// it would be nice to find a way to move this hack to config/mapOverrides.json
if(!si || !si->campState)
return false;
std::string campaign = si->campState->getFilename();
if (!boost::starts_with(campaign, "DATA/YOG")) // "Birth of a Barbarian"
return false;
if (getHeroType() != HeroTypeID::SOLMYR) // Yog (based on Solmyr)
return false;
return true;
}
bool CGHeroInstance::isCampaignGem() const
{
const StartInfo *si = cb->getStartInfo();
// it would be nice to find a way to move this hack to config/mapOverrides.json
if(!si || !si->campState)
return false;
std::string campaign = si->campState->getFilename();
if (!boost::starts_with(campaign, "DATA/GEM") && !boost::starts_with(campaign, "DATA/FINAL")) // "New Beginning" and "Unholy Alliance"
return false;
if (getHeroType() != HeroTypeID::GEM) // Yog (based on Solmyr)
return false;
return true;
}
VCMI_LIB_NAMESPACE_END