소스 검색

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.
ArseniyShestakov 10 년 전
부모
커밋
445ded71a7
1개의 변경된 파일5개의 추가작업 그리고 1개의 파일을 삭제
  1. 5 1
      server/CGameHandler.cpp

+ 5 - 1
server/CGameHandler.cpp

@@ -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;