mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
Give hero move points at day of visiting stable, fixes #2598
This commit is contained in:
parent
48702a26a4
commit
e3992de50e
@ -276,16 +276,17 @@ struct SetMana : public CPackForClient
|
|||||||
|
|
||||||
struct SetMovePoints : public CPackForClient
|
struct SetMovePoints : public CPackForClient
|
||||||
{
|
{
|
||||||
SetMovePoints(){val = 0;}
|
SetMovePoints(){val = 0; absolute=true;}
|
||||||
void applyCl(CClient *cl);
|
void applyCl(CClient *cl);
|
||||||
DLL_LINKAGE void applyGs(CGameState *gs);
|
DLL_LINKAGE void applyGs(CGameState *gs);
|
||||||
|
|
||||||
ObjectInstanceID hid;
|
ObjectInstanceID hid;
|
||||||
si32 val;
|
si32 val;
|
||||||
|
bool absolute;
|
||||||
|
|
||||||
template <typename Handler> void serialize(Handler &h, const int version)
|
template <typename Handler> void serialize(Handler &h, const int version)
|
||||||
{
|
{
|
||||||
h & val & hid;
|
h & val & hid & absolute;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -206,7 +206,15 @@ DLL_LINKAGE void SetMana::applyGs(CGameState *gs)
|
|||||||
DLL_LINKAGE void SetMovePoints::applyGs(CGameState *gs)
|
DLL_LINKAGE void SetMovePoints::applyGs(CGameState *gs)
|
||||||
{
|
{
|
||||||
CGHeroInstance *hero = gs->getHero(hid);
|
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)
|
DLL_LINKAGE void FoWChange::applyGs(CGameState *gs)
|
||||||
|
@ -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.bonus = Bonus(Bonus::ONE_WEEK, Bonus::LAND_MOVEMENT, Bonus::OBJECT, 600, 94, VLC->generaltexth->arraytxt[100]);
|
||||||
gb.id = heroID.getNum();
|
gb.id = heroID.getNum();
|
||||||
cb->giveHeroBonus(&gb);
|
cb->giveHeroBonus(&gb);
|
||||||
|
|
||||||
|
SetMovePoints mp;
|
||||||
|
mp.val = 600;
|
||||||
|
mp.absolute = false;
|
||||||
|
mp.hid = heroID;
|
||||||
|
cb->setMovePoints(&mp);
|
||||||
|
|
||||||
iw.text << VLC->generaltexth->allTexts[580];
|
iw.text << VLC->generaltexth->allTexts[580];
|
||||||
cb->showInfoDialog(&iw);
|
cb->showInfoDialog(&iw);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user