Add IntMapHelper, locate wall cutting bug

This commit is contained in:
jgk
2021-05-22 15:14:21 +02:00
parent 26f0ca4ab5
commit 9c2bcbec10
35 changed files with 221 additions and 139 deletions
+7 -4
View File
@@ -12,6 +12,8 @@ import Dodge.Room.Data
import Dodge.Default
import Geometry
import Dodge.Room.Link
import qualified IntMapHelp as IM
import Dodge.Debug.LinkDecoration
import Control.Monad.State
import Control.Lens
@@ -21,11 +23,12 @@ import System.Random
import Data.Tree
import Data.Graph.Inductive.Graph (labNodes)
import qualified Data.Map as M
import qualified Data.IntMap.Strict as IM
generateFromList :: State StdGen [Room] -> World -> World
generateFromList gr w = updateWallZoning
generateLevelFromRoomList :: State StdGen [Room] -> World -> World
generateLevelFromRoomList gr w = updateWallZoning
. placeSpots plmnts
. addRoomPolyDecorations rs
. addRoomLinkDecorations rs
$ w { _walls = wallsFromRooms rs
}
where
@@ -95,7 +98,7 @@ divideWall wl
divideWallIn :: Wall -> IM.IntMap Wall -> IM.IntMap Wall
divideWallIn wl wls =
let (wl':newWls) = divideWall wl
k = newKey wls
k = IM.newKey wls
newWls' = zipWith (\i w -> w {_wlID = i}) [k..] newWls
in foldr (\w -> IM.insert (_wlID w) w) wls (wl':newWls')