Broken level generation with error message on run

This commit is contained in:
2021-03-28 20:44:09 +02:00
parent 1c11d82878
commit 34ddd01825
2 changed files with 47 additions and 42 deletions
+10 -5
View File
@@ -20,12 +20,16 @@ import qualified Data.Set as S
-- ie returns a new set of walls with a hole determined by anticlockwise ordering of the points
cutWalls' :: [Point2] -> IM.IntMap Wall -> IM.IntMap Wall
cutWalls' qs walls =
IM.filter (not.wallIsZeroLength)
. fuseWallsWith zs
.createPolyWalls rs
nubWalls
. IM.filter (not.wallIsZeroLength)
. removeWallsInPolygon ps
$ fuseWallsWith zs cwals
. fuseWallsWith zs
. createPolyWalls rs
. IM.filter (not.wallIsZeroLength)
-- . removeWallsInPolygon ps
-- $ fuseWallsWith zs cwals
. fuseWallsWith zs
$ removeWallsInPolygon ps
cwals
where
(zs,cwals) = cutWallsWithPoints ps walls
ps = orderPolygon qs
@@ -38,6 +42,7 @@ cutWalls' qs walls =
-- also remove any walls that ended up zero length
-- draw the required new walls along the polygon boundary
-- the following checks one of the corners of cut walls at each step
cutWalls :: [Point2] -> IM.IntMap Wall -> IM.IntMap Wall
cutWalls ps wls = case mapMaybe (flip checkWallRight newWalls) newWallsList of
[] -> newWalls