Skip to content

Commit

Permalink
Fix DEBUG
Browse files Browse the repository at this point in the history
  • Loading branch information
joelverhagen committed Jan 14, 2024
1 parent d56e319 commit 30bb74a
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/FactorioTools/OilField/Visualizer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public static void Show(SquareGrid grid)
Show(grid, Array.Empty<IPoint>(), Array.Empty<IEdge>());
}

public static void Show(SquareGrid grid, IEnumerable<IPoint> points, IEnumerable<IEdge> edges)
public static void Show(SquareGrid grid, IReadOnlyCollection<IPoint> points, IReadOnlyCollection<IEdge> edges)
{
var path = System.IO.Path.Combine(System.IO.Path.GetTempPath(), "Knapcode.FactorioTools.OilField.png");
Save(grid, path, points, edges);
Expand All @@ -30,7 +30,7 @@ public static void Show(SquareGrid grid, IEnumerable<IPoint> points, IEnumerable
p.Start();
}

private static void Save(SquareGrid grid, string path, IEnumerable<IPoint> points, IEnumerable<IEdge> edges)
private static void Save(SquareGrid grid, string path, IReadOnlyCollection<IPoint> points, IReadOnlyCollection<IEdge> edges)
{
var image = new Image<Rgba32>(grid.Width * CellSize, grid.Height * CellSize);

Expand Down Expand Up @@ -74,17 +74,17 @@ private static void Save(SquareGrid grid, string path, IEnumerable<IPoint> point
}
var pairs = new HashSet<(Location A, Location B)>();
foreach ((var pole, var location) in grid.EntityToLocation)
foreach (var location in grid.EntityLocations.EnumerateItems())
{
var center = pole as ElectricPoleCenter;
var center = grid[location] as ElectricPoleCenter;
if (center is null)
{
continue;
}
foreach (var neighbor in center.Neighbors)
{
var (a, b) = (location, grid.EntityToLocation[neighbor]);
var (a, b) = (location, grid.EntityIdToLocation[neighbor.Id]);
if (a > b)
{
(a, b) = (b, a);
Expand Down

0 comments on commit 30bb74a

Please sign in to comment.