Start to remove explicit "outplacements"

This commit is contained in:
2025-09-23 17:11:07 +01:00
parent ef90e5702b
commit a6ca90d7d8
15 changed files with 67 additions and 44 deletions
+6 -1
View File
@@ -6,6 +6,7 @@
-}
module Dodge.Placement.PlaceSpot (placeSpot) where
import Data.Maybe
import Color
import Control.Monad.State
import Data.Bifunctor
@@ -41,9 +42,13 @@ placePlainPSSpot
placePlainPSSpot w rm plmnt shift =
let (i, w') = placeSpotID rm (shiftPSBy shift (_plSpot plmnt)) (_plType plmnt) w
newplmnt = plmnt & plMID ?~ i
in maybe ((w', rm & rmPmnts .:~ newplmnt), [newplmnt])
((gw,rm'),plist) = maybe ((w', rm & rmPmnts .:~ newplmnt), [newplmnt])
(recrPlace newplmnt w') (_plIDCont plmnt w' newplmnt)
in ((f newplmnt gw,rm'),plist)
where
f x gw = fromMaybe gw $ do
j <- x ^. plExternalID
return $ gw & genPmnt . at j ?~ [x]
recrPlace newplmnt w' pl =
let (wr, newplmnts) = placeSpot (w', rm & rmPmnts .:~ newplmnt) pl
in (wr, newplmnt : newplmnts)