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

Movement: now hero will always ignore guards if visiting object that he staying on

This one is replicating original game behaviour and fixes issue 1990 and related to issue 2084.
Currently this is mainly caused problem with teleporters which lead to crash in AI due to unexcepted hero loss.
This commit is contained in:
ArseniyShestakov 2015-02-22 20:12:49 +03:00
parent 00de870f17
commit 445ded71a7

View File

@ -1747,7 +1747,11 @@ bool CGameHandler::moveHero( ObjectInstanceID hid, int3 dst, ui8 teleporting, Pl
tmh.result = result;
sendAndApply(&tmh);
if(lookForGuards == CHECK_FOR_GUARDS && this->isInTheMap(guardPos))
if (visitDest == VISIT_DEST && t.topVisitableObj() && t.topVisitableObj()->id == h->id)
{ // 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))
{
tmh.attackedFrom = guardPos;