Cleanup, fix menu lock on restarting level after game over
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user