stopped branches between exits for roads
This commit is contained in:
@@ -13,6 +13,7 @@ import (
|
|||||||
type PointOfInterest struct {
|
type PointOfInterest struct {
|
||||||
X, Y int
|
X, Y int
|
||||||
Connections int
|
Connections int
|
||||||
|
IsExit bool
|
||||||
}
|
}
|
||||||
|
|
||||||
type Road struct {
|
type Road struct {
|
||||||
@@ -108,7 +109,8 @@ func generatePOIs(width, height int, settings *Settings, allWaterPixels []image.
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if found {
|
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
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Don't connect two exit points
|
||||||
|
if poi.IsExit && other.IsExit {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
if closest == nil || dist < minDist {
|
if closest == nil || dist < minDist {
|
||||||
minDist = dist
|
minDist = dist
|
||||||
closest = other
|
closest = other
|
||||||
|
|||||||
Reference in New Issue
Block a user