Generate more elaborate roads

Updates the random map generator to produce more elaborate roads:

- Roads extend beyond map bounds.
- Shorter, unviable roads are pruned and merged to create longer roads.
- Roads can loop.
This commit is contained in:
Ashley Newson
2025-01-14 01:12:38 +00:00
committed by Gustas
parent 5f9e0ffd43
commit 9d77ca2bf8
4 changed files with 282 additions and 83 deletions

View File

@@ -105,6 +105,16 @@ namespace OpenRA.Mods.Common.MapGenerator
return x >= 0 && x < Size.X && y >= 0 && y < Size.Y;
}
public bool IsEdge(int x, int y)
{
return x == 0 || x == Size.X - 1 || y == 0 || y == Size.Y - 1;
}
public bool IsEdge(int2 xy)
{
return IsEdge(xy.X, xy.Y);
}
/// <summary>Clamp xy to be the closest index within the matrix.</summary>
public int2 ClampXY(int2 xy)
{