Cleanup, fix menu lock on restarting level after game over

This commit is contained in:
2021-12-06 23:44:10 +00:00
parent 19540bd19e
commit 763b771928
18 changed files with 88 additions and 119 deletions
+4 -3
View File
@@ -23,8 +23,9 @@ import Data.Maybe
import Data.List (scanl',sortOn)
combinationsTrie :: Trie (Int,CombineType) Item
combinationsTrie = foldr (uncurry insertInTrie) emptyTrie
$ map (first (sortOn snd)) itemCombinations
combinationsTrie = foldr (uncurry insertInTrie . first (sortOn snd))
emptyTrie
itemCombinations
-- this can probably be improved by going through accessing the combinations
-- trie going through each combine type in your inventory in order, rather than
@@ -34,7 +35,7 @@ lookupItems' :: [(CombineType,Int,Int)] -> [ ([Int],Item) ]
lookupItems' xs = lookupItems (sortOn (\(ct,_,_) -> ct) xs) combinationsTrie
lookupItems :: [(CombineType,Int,Int)] -> Trie (Int,CombineType) Item -> [ ([Int],Item) ]
lookupItems [] t = maybeToList $ fmap ([],) $ _trieMVal t
lookupItems [] t = maybeToList $ ([],) <$> _trieMVal t
lookupItems ((ct,i,n):xs) t = do
n' <- [1..min n 4]
let is = replicate n' i