Cleanup
This commit is contained in:
+10
-12
@@ -3,7 +3,7 @@ module Dodge.Combine
|
||||
( combinePoss
|
||||
, combineSizes
|
||||
, combineItemListYou
|
||||
, combineItemListStringInfo
|
||||
, combineListInfo
|
||||
, toggleCombineInv
|
||||
, enterCombineInv
|
||||
) where
|
||||
@@ -45,24 +45,22 @@ splitIcAmounts = concatMap f
|
||||
where
|
||||
f (x,n,y) = [((i,x),(i,y)) | i <- [1..n]]
|
||||
|
||||
lookupItems' :: IM.IntMap Item -> [([(IcAmount,Int)],Item)]
|
||||
lookupItems' = flip multiLookupTrieI combinationsTrie . sortOn fst . splitIcAmounts . invertInventory
|
||||
lookupItems :: IM.IntMap Item -> [([(IcAmount,Int)],Item)]
|
||||
lookupItems = flip multiLookupTrieI combinationsTrie . sortOn fst . splitIcAmounts . invertInventory
|
||||
|
||||
combineItemListYouX :: World -> [([Int],Item)]
|
||||
combineItemListYouX = map (first f) . lookupItems' . yourInv
|
||||
combineItemListYouX = map (first $ concatMap g) . lookupItems . yourInv
|
||||
where
|
||||
f = concatMap g
|
||||
g (amount,i) = replicate (_toInt amount) i
|
||||
|
||||
combineItemListStringInfo :: World -> [([Int],([String],Item))]
|
||||
combineItemListStringInfo w = filter (f . snd . snd) . map (cmm inv) $ combineItemListYouX w
|
||||
--combineItemListStringInfo w = map (cmm inv) $ combineItemListYouX w
|
||||
combineListInfo :: World -> [([Int],([String],Item))]
|
||||
combineListInfo w = filter (f . snd . snd) . map (cmm inv) $ combineItemListYouX w
|
||||
where
|
||||
inv = yourInv w
|
||||
f itm = _itType itm `notElem` fmap _itType inv
|
||||
|
||||
combineItemListYou :: World -> [([Int],Item)]
|
||||
combineItemListYou = map (second snd) . combineItemListStringInfo
|
||||
combineItemListYou = map (second snd) . combineListInfo
|
||||
|
||||
cmm :: IM.IntMap Item -> ([Int],Item) -> ([Int],([String],Item))
|
||||
cmm inv (is,itm) = (is,itm & itType . iyModules %%~ flip combineModuleMaps mms)
|
||||
@@ -72,12 +70,12 @@ cmm inv (is,itm) = (is,itm & itType . iyModules %%~ flip combineModuleMaps mms)
|
||||
combineModuleMaps :: M.Map ModuleSlot ItemModuleType
|
||||
-> [M.Map ModuleSlot ItemModuleType]
|
||||
-> ([String],M.Map ModuleSlot ItemModuleType)
|
||||
combineModuleMaps = foldM cMod
|
||||
combineModuleMaps = foldM combineTwoModuleMaps
|
||||
|
||||
cMod :: M.Map ModuleSlot ItemModuleType
|
||||
combineTwoModuleMaps :: M.Map ModuleSlot ItemModuleType
|
||||
-> M.Map ModuleSlot ItemModuleType
|
||||
-> ([String],M.Map ModuleSlot ItemModuleType)
|
||||
cMod = mergeA
|
||||
combineTwoModuleMaps = mergeA
|
||||
preserveMissing
|
||||
(filterAMissing f)
|
||||
(zipWithAMatched g)
|
||||
|
||||
Reference in New Issue
Block a user