Commit before generalising picture transformation to alternative

This commit is contained in:
2021-07-21 14:38:57 +02:00
parent e5bee30f5b
commit 0aa437d035
6 changed files with 25 additions and 20 deletions
+3 -2
View File
@@ -18,13 +18,14 @@ import Control.Lens
import Control.Monad.State
import Data.Maybe
import qualified Data.IntMap.Strict as IM
import Data.Foldable
withThinSmoke
:: (Creature -> World -> World) -- ^ Underlying effect
-> Creature
-> World
-> World
withThinSmoke eff cr w = eff cr $ foldr (makeThinSmokeAt . (+.+ pos)) w ps
withThinSmoke eff cr w = eff cr $ foldl' (flip $ makeThinSmokeAt . (+.+ pos)) w ps
where
dir = _crDir cr
pos = _crPos cr +.+ (_crRad cr +0.5) *.* unitVectorAtAngle dir
@@ -35,7 +36,7 @@ withThickSmoke
-> Creature
-> World
-> World
withThickSmoke eff cr w = eff cr $ foldr (makeThickSmokeAt . (+.+ pos)) w ps
withThickSmoke eff cr w = eff cr $ foldl' (flip $ makeThickSmokeAt . (+.+ pos)) w ps
where
dir = _crDir cr
pos = _crPos cr +.+ (_crRad cr + 15) *.* unitVectorAtAngle dir