mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
moveHero: add transit validation and avoid embarking on transit
Hero shouldn't embark into boat when attempt to transit over air layer.
This commit is contained in:
parent
c188ff0a92
commit
62dc070c0a
@ -1794,6 +1794,8 @@ bool CGameHandler::moveHero( ObjectInstanceID hid, int3 dst, ui8 teleporting, bo
|
||||
&& complain("Can not move garrisoned hero!"))
|
||||
|| ((h->movement < cost && dst != h->pos && !teleporting)
|
||||
&& complain("Hero doesn't have any movement points left!"))
|
||||
|| ((transit && !h->canFly() && !CGTeleport::isTeleport(t.topVisitableObj()))
|
||||
&& complain("Hero cannot transit over this tile!"))
|
||||
/*|| (states.checkFlag(h->tempOwner, &PlayerStatus::engagedIntoBattle)
|
||||
&& complain("Cannot move hero during the battle"))*/)
|
||||
{
|
||||
@ -1866,7 +1868,7 @@ bool CGameHandler::moveHero( ObjectInstanceID hid, int3 dst, ui8 teleporting, bo
|
||||
};
|
||||
|
||||
|
||||
if(embarking)
|
||||
if(!transit && embarking)
|
||||
{
|
||||
tmh.movePoints = h->movementPointsAfterEmbark(h->movement, cost, false);
|
||||
return doMove(TryMoveHero::EMBARK, IGNORE_GUARDS, DONT_VISIT_DEST, LEAVING_TILE);
|
||||
|
Loading…
Reference in New Issue
Block a user