瀏覽代碼

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;
 				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->turns >= turnAtNextTile  &&  dp->moveRemains < remains)) //this route is faster
 				|| (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
 				assert(dp != cp->theNodeBefore); //two tiles can't point to each other
 				dp->moveRemains = remains;
 				dp->moveRemains = remains;
@@ -3596,6 +3595,9 @@ bool CPathfinder::isMovementPossible()
 		}
 		}
 	}
 	}
 
 
+	if(isSourceGuarded() && !isDestinationGuardian()) // Can step into tile of guard
+		return false;
+
 	return true;
 	return true;
 }
 }