Cleanup, split CWorld into separate file

This commit is contained in:
2022-07-26 21:19:12 +01:00
parent c2707719fb
commit 6554d219dc
27 changed files with 1049 additions and 911 deletions
+3 -3
View File
@@ -8,7 +8,7 @@ import Control.Lens
doButtonEvent :: ButtonEvent -> Button -> World -> World
doButtonEvent be = case be of
ButtonDoNothing -> const id
ButtonPress newstate newevent thesound f -> \b -> doWorldEffect f
ButtonPress newstate newevent thesound f -> \b -> doWdWd f
. set (cWorld . buttons . ix (_btID b) . btState) newstate
. set (cWorld . buttons . ix (_btID b) . btEvent) newevent
. soundStart (LeverSound 0) (_btPos b) thesound Nothing
@@ -18,9 +18,9 @@ doButtonEvent be = case be of
flipSwitch :: WdWd -> WdWd -> Button -> World -> World
flipSwitch oneff offeff bt
| _btState bt == BtOff = doWorldEffect oneff . dosound
| _btState bt == BtOff = doWdWd oneff . dosound
. over (cWorld . buttons . ix (_btID bt)) turnon
| otherwise = doWorldEffect offeff . dosound
| otherwise = doWdWd offeff . dosound
. over (cWorld . buttons . ix (_btID bt)) turnoff
where
turnon = (btState .~ BtOn ) . (btText .~ "SWITCH\\")