1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-02-03 13:01:33 +02:00

Extending hero info callback

Allow to check battle enemy hero details + adding max spell points to available data
This commit is contained in:
dydzio 2016-09-27 13:48:04 +02:00
parent 2576dd4692
commit d831c087d9
3 changed files with 12 additions and 1 deletions

View File

@ -273,6 +273,16 @@ bool CGameInfoCallback::getHeroInfo(const CGObjectInstance * hero, InfoAboutHero
bool accessFlag = hasAccess(h->tempOwner);
if (!accessFlag && gs->curB) //if it's battle we can get enemy hero full data
{
ui8 playerSide = gs->curB->playerToSide(*player);
if (playerSide >= 0)
{
if (gs->curB->sides[!playerSide].hero == h)
accessFlag = true;
}
}
if(!accessFlag && nullptr != selectedObject)
{
const CGHeroInstance * selectedHero = dynamic_cast<const CGHeroInstance *>(selectedObject);

View File

@ -3044,6 +3044,7 @@ void InfoAboutHero::initFromHero(const CGHeroInstance *h, bool detailed)
details->luck = h->LuckVal();
details->morale = h->MoraleVal();
details->mana = h->mana;
details->manaLimit = h->manaLimit();
details->primskills.resize(GameConstants::PRIMARY_SKILLS);
for (int i = 0; i < GameConstants::PRIMARY_SKILLS ; i++)

View File

@ -48,7 +48,7 @@ public:
struct DLL_LINKAGE Details
{
std::vector<si32> primskills;
si32 mana, luck, morale;
si32 mana, manaLimit, luck, morale;
} *details;
const CHeroClass *hclass;