diff --git a/roads.go b/roads.go index 4c5cc55..599d132 100644 --- a/roads.go +++ b/roads.go @@ -13,6 +13,7 @@ import ( type PointOfInterest struct { X, Y int Connections int + IsExit bool } type Road struct { @@ -108,7 +109,8 @@ func generatePOIs(width, height int, settings *Settings, allWaterPixels []image. } } if found { - pois = append(pois, &PointOfInterest{X: x, Y: y}) + isExit := i < numExits + pois = append(pois, &PointOfInterest{X: x, Y: y, IsExit: isExit}) } } @@ -169,6 +171,11 @@ func connectPOIs(pois []*PointOfInterest, width, height int, settings *Settings, continue } + // Don't connect two exit points + if poi.IsExit && other.IsExit { + continue + } + if closest == nil || dist < minDist { minDist = dist closest = other