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

Merge pull request #245 from vmarkovtsev/develop

Add commander resurrection info window upon entering town
This commit is contained in:
Vadim Markovtsev 2016-10-29 21:55:34 +02:00 committed by GitHub
commit 9651676452

View File

@ -562,15 +562,25 @@ void CGTownInstance::onHeroVisit(const CGHeroInstance * h) const
}
else if(h->visitablePos() == visitablePos())
{
if (h->commander && !h->commander->alive) //rise commander. TODO: interactive script
bool commander_recover = h->commander && !h->commander->alive;
if (commander_recover) // rise commander from dead
{
SetCommanderProperty scp;
scp.heroid = h->id;
scp.which = SetCommanderProperty::ALIVE;
scp.amount = 1;
cb->sendAndApply (&scp);
cb->sendAndApply(&scp);
}
cb->heroVisitCastle(this, h);
// TODO(vmarkovtsev): implement payment for rising the commander
if (commander_recover) // info window about commander
{
InfoWindow iw;
iw.player = h->tempOwner;
iw.text << h->commander->getName();
iw.components.push_back(Component(*h->commander));
cb->showInfoDialog(&iw);
}
}
else
{