소스 검색

CPathfinder: move one more check into isMovementPossible

ArseniyShestakov 10 년 전
부모
커밋
5a04f05b9b
1개의 변경된 파일4개의 추가작업 그리고 2개의 파일을 삭제
  1. 4 2
      lib/CGameState.cpp

+ 4 - 2
lib/CGameState.cpp

@@ -3477,10 +3477,9 @@ void CPathfinder::calculatePaths()
 				remains = moveAtNextTile - cost;
 			}
 
-			if((dp->turns==0xff		//we haven't been here before
+			if(dp->turns==0xff		//we haven't been here before
 				|| dp->turns > turnAtNextTile
 				|| (dp->turns >= turnAtNextTile  &&  dp->moveRemains < remains)) //this route is faster
-				&& (!isSourceGuarded() || isDestinationGuardian())) // Can step into tile of guard
 			{
 				assert(dp != cp->theNodeBefore); //two tiles can't point to each other
 				dp->moveRemains = remains;
@@ -3596,6 +3595,9 @@ bool CPathfinder::isMovementPossible()
 		}
 	}
 
+	if(isSourceGuarded() && !isDestinationGuardian()) // Can step into tile of guard
+		return false;
+
 	return true;
 }