Skip to content

Commit 60b1fa4

Browse files
committed
Documenting how FindInRing differs from GetTilesWithinRankDistance
1 parent a7826b1 commit 60b1fa4

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

C7Engine/C7GameData/Tile.cs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -616,6 +616,28 @@ public Tile GetTileAtNeighborIndex(int neighborIndex) {
616616
return map.tileAt(XCoordinate + xDelta, YCoordinate + yDelta);
617617
}
618618

619+
620+
/// <summary>
621+
/// <para>
622+
/// Walks clockwise/counter-clockwise the nth ring around
623+
/// the specified tile starting on the northmost tile
624+
/// and tries to find the first tile that matches our boolean criterion.
625+
/// </para>
626+
/// <para>
627+
/// This differs from <see cref="GetTilesWithinRankDistance"/>,
628+
/// because it includes all the tiles regardless of the distance.
629+
/// An example would be that GetTilesWithinRankDistance() with a rank of 2
630+
/// will not return a NN, SS, WW, or EE tile, whereas this method will.
631+
/// </para>
632+
/// <para>
633+
/// It is mostly used to calculate to whom we should assign tiles
634+
/// that are being claimed by more than 1 city or civilization.
635+
/// </para>
636+
/// </summary>
637+
/// <param name="rank"></param>
638+
/// <param name="predicate"></param>
639+
/// <param name="clockwise"></param>
640+
/// <returns></returns>
619641
public Tile FindInRing(int rank, Func<Tile, bool> predicate, bool clockwise = true) {
620642
Tile startingTile = map.tileAt(this.XCoordinate, this.YCoordinate - (2 * rank));
621643

0 commit comments

Comments
 (0)