Cleanup invSelectionItem
This commit is contained in:
+3
-49
@@ -12,7 +12,6 @@ import Dodge.Data.Combine
|
||||
import Dodge.Data.Universe
|
||||
import Dodge.Item.Display
|
||||
import Dodge.Item.InventoryColor
|
||||
--import Dodge.Module
|
||||
import qualified IntMapHelp as IM
|
||||
import SimpleTrie
|
||||
|
||||
@@ -36,59 +35,14 @@ combineItemListYouX :: World -> [([Int], Item)]
|
||||
combineItemListYouX = map (first concat) . flatLookupItems . yourInv
|
||||
|
||||
combineList :: World -> [SelectionItem CombinableItem]
|
||||
combineList = map f . combineListInfo
|
||||
combineList = map f . combineItemListYouX
|
||||
where
|
||||
f (is, (strs, itm)) =
|
||||
f (is, itm) =
|
||||
SelectionItem
|
||||
{ _siPictures = basicItemDisplay itm
|
||||
, _siHeight = _itInvSize itm
|
||||
, _siIsSelectable = True
|
||||
, _siColor = itemInvColor itm
|
||||
, _siOffX = 0
|
||||
, _siPayload = CombinableItem is itm strs
|
||||
, _siPayload = CombinableItem is itm []
|
||||
}
|
||||
|
||||
combineListInfo :: World -> [([Int], ([String], Item))]
|
||||
combineListInfo w = map (cmm inv) $ combineItemListYouX w
|
||||
where
|
||||
inv = yourInv w
|
||||
--combineListInfo w = filter f . map (cmm inv) $ combineItemListYouX w
|
||||
-- where
|
||||
-- inv = yourInv w
|
||||
-- f (is, (_, itm)) = _itType itm `notElem` fmap _itType (IM.restrictKeys inv (IS.fromList is))
|
||||
|
||||
cmm :: IM.IntMap Item -> ([Int], Item) -> ([Int], ([String], Item))
|
||||
cmm _ (is, itm) = (is, ([], itm))
|
||||
|
||||
--cmm :: IM.IntMap Item -> ([Int], Item) -> ([Int], ([String], Item))
|
||||
--cmm inv (is, itm) = (is, itm & itType . iyModules %%~ flip combineModuleMaps mms)
|
||||
-- where
|
||||
-- mms = map (_iyModules . _itType . (inv IM.!)) is
|
||||
|
||||
--combineModuleMaps ::
|
||||
-- M.Map ModuleSlot ItemModuleType ->
|
||||
-- [M.Map ModuleSlot ItemModuleType] ->
|
||||
-- ([String], M.Map ModuleSlot ItemModuleType)
|
||||
--combineModuleMaps = foldM combineTwoModuleMaps
|
||||
|
||||
--combineTwoModuleMaps ::
|
||||
-- M.Map ModuleSlot ItemModuleType ->
|
||||
-- M.Map ModuleSlot ItemModuleType ->
|
||||
-- ([String], M.Map ModuleSlot ItemModuleType)
|
||||
--combineTwoModuleMaps =
|
||||
-- mergeA
|
||||
-- preserveMissing
|
||||
-- (filterAMissing f)
|
||||
-- (zipWithAMatched g)
|
||||
-- where
|
||||
-- f _ EMPTYMODULE = ([], False)
|
||||
-- f _ md = ([rm "REMOVES" md], False)
|
||||
-- g _ EMPTYMODULE md = ([], md)
|
||||
-- g _ md EMPTYMODULE = ([], md)
|
||||
-- g _ md2 md1 = ([rm "REPLACES" md1 ++ rm " WITH" md2], md2)
|
||||
-- rm str md = str ++ " " ++ fullModuleName md
|
||||
|
||||
-- g above could be a monoid of some description...
|
||||
|
||||
--fullModuleName :: ItemModuleType -> String
|
||||
--fullModuleName = fromMaybe "EMPTYMODULE" . moduleName
|
||||
|
||||
Reference in New Issue
Block a user