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

Merge pull request #296 from Chocimier/iss2598

Give hero move points at day of visiting stable, fixes #2598
This commit is contained in:
DjWarmonger 2017-05-13 12:17:03 +02:00 committed by GitHub
commit adaa8277b1
3 changed files with 19 additions and 3 deletions

View File

@ -276,16 +276,17 @@ struct SetMana : public CPackForClient
struct SetMovePoints : public CPackForClient
{
SetMovePoints(){val = 0;}
SetMovePoints(){val = 0; absolute=true;}
void applyCl(CClient *cl);
DLL_LINKAGE void applyGs(CGameState *gs);
ObjectInstanceID hid;
si32 val;
bool absolute;
template <typename Handler> void serialize(Handler &h, const int version)
{
h & val & hid;
h & val & hid & absolute;
}
};

View File

@ -206,7 +206,15 @@ DLL_LINKAGE void SetMana::applyGs(CGameState *gs)
DLL_LINKAGE void SetMovePoints::applyGs(CGameState *gs)
{
CGHeroInstance *hero = gs->getHero(hid);
hero->movement = val;
assert(hero);
if(absolute)
hero->movement = val;
else
hero->movement += val;
vstd::amax(hero->movement, 0); //not less than 0
}
DLL_LINKAGE void FoWChange::applyGs(CGameState *gs)

View File

@ -1302,6 +1302,13 @@ void COPWBonus::onHeroVisit (const CGHeroInstance * h) const
gb.bonus = Bonus(Bonus::ONE_WEEK, Bonus::LAND_MOVEMENT, Bonus::OBJECT, 600, 94, VLC->generaltexth->arraytxt[100]);
gb.id = heroID.getNum();
cb->giveHeroBonus(&gb);
SetMovePoints mp;
mp.val = 600;
mp.absolute = false;
mp.hid = heroID;
cb->setMovePoints(&mp);
iw.text << VLC->generaltexth->allTexts[580];
cb->showInfoDialog(&iw);
}