浏览代码

moveHero: add transit validation and avoid embarking on transit

Hero shouldn't embark into boat when attempt to transit over air layer.
ArseniyShestakov 10 年之前
父节点
当前提交
62dc070c0a
共有 1 个文件被更改,包括 3 次插入1 次删除
  1. 3 1
      server/CGameHandler.cpp

+ 3 - 1
server/CGameHandler.cpp

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