Add rooms, placements and room positions

This commit is contained in:
2022-03-08 22:57:58 +00:00
parent 2e1c7f2687
commit ff6064a3b6
14 changed files with 315 additions and 138 deletions
+20 -3
View File
@@ -67,20 +67,37 @@ posRms bounds parenti@(parent,_) ( (numChild,t@(Node childi _) ):its) tseq = do
clipping = or (convexPolysOverlap <$> newBounds <*> bounds)
updateparent rm = doLnkEff (lnkPosDir outlnk) $ rm
& rmLinks %~ delete outlnk
& rmPos .:~ uncurry (UsedOutLink numChild (snd childi)) (lnkPosDir outlnk)
& rmPos .:~ UsedOutLink
{ _rpChildNum = numChild
, _rpOutRoomID = snd childi
, _rpPos = fst (lnkPosDir outlnk)
, _rpDir = snd (lnkPosDir outlnk)
, _rpLinkType = _rlType outlnk
}
& rmChildren .:~ snd childi
shiftedoutlink = shiftLinkBy (_rmShift parent) outlnk
updatechild rm = rm
& rmMParent ?~ snd parenti
& rmMID ?~ snd childi
& rmLinks %~ delete il
& rmPos .:~ uncurry (UsedInLink 0) (lnkPosDir il)
& rmPos .:~ UsedInLink
{ _rpInRoomID = 0
, _rpPos = fst (lnkPosDir il)
, _rpDir = snd (lnkPosDir il)
, _rpLinkType = _rlType il
}
shiftedt = applyToRoot
(first $ updatechild . shiftRoomShiftToLink (lnkPosDir shiftedoutlink) (lnkPosDir il))
t
createUnusedLinkPos :: Room -> Room
createUnusedLinkPos rm = rm & rmPos .++~ map (uncurry UnusedLink . lnkPosDir) (_rmLinks rm)
createUnusedLinkPos rm = rm & rmPos .++~ map f (_rmLinks rm)
where
f rl = UnusedLink
{ _rpPos = _rlPos rl
, _rpDir = _rlDir rl
, _rpLinkType = _rlType rl
}
zipCount :: [a] -> [(Int,a)]
zipCount = Prelude.zip [0..]