1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-12 02:28:11 +02:00

Remove final path node when directly attacking guards

This commit is contained in:
Ivan Savenko 2023-03-31 22:42:32 +03:00
parent e9aed2761c
commit 56e1866db9

View File

@ -2418,6 +2418,9 @@ bool CGameHandler::moveHero(ObjectInstanceID hid, int3 dst, ui8 teleporting, boo
if (leavingTile == LEAVING_TILE)
leaveTile();
if (isInTheMap(guardPos))
tmh.attackedFrom = boost::make_optional(guardPos);
tmh.result = result;
sendAndApply(&tmh);
@ -2425,10 +2428,8 @@ bool CGameHandler::moveHero(ObjectInstanceID hid, int3 dst, ui8 teleporting, boo
{ // Hero should be always able to visit any object he staying on even if there guards around
visitObjectOnTile(t, h);
}
else if (lookForGuards == CHECK_FOR_GUARDS && this->isInTheMap(guardPos))
else if (lookForGuards == CHECK_FOR_GUARDS && isInTheMap(guardPos))
{
tmh.attackedFrom = boost::make_optional(guardPos);
const TerrainTile &guardTile = *gs->getTile(guardPos);
objectVisited(guardTile.visitableObjects.back(), h);