瀏覽代碼

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;
 		tmh.result = result;
 		sendAndApply(&tmh);
 		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;
 			tmh.attackedFrom = guardPos;